feat: 完善知识库预览功能与配置管理优化

This commit is contained in:
caoxiaozhu
2026-05-09 07:29:49 +00:00
parent d9133193e8
commit 94122fd34b
26 changed files with 20232 additions and 300 deletions

View File

@@ -0,0 +1,30 @@
function clampHeight(viewportHeight) {
const numericHeight = Number(viewportHeight)
if (!Number.isFinite(numericHeight) || numericHeight <= 0) {
return 720
}
return Math.max(520, numericHeight - 220)
}
export function buildOnlyOfficePreviewConfig(config, options = {}) {
const viewportHeight = options.viewportHeight
const editorConfig = {
...(config.editorConfig || {}),
embedded: {
embedUrl: '',
fullscreenUrl: '',
saveUrl: '',
shareUrl: '',
toolbarDocked: 'top'
}
}
return {
...config,
type: 'embedded',
editorConfig,
width: '100%',
height: `${clampHeight(viewportHeight)}px`
}
}