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

@@ -4,6 +4,30 @@ function supportsOnlyOfficePreview(document) {
return ONLYOFFICE_EXTENSIONS.has(String(document?.extension || '').toLowerCase())
}
export function shouldRenderOnlyOfficePreview(document, options = {}) {
if (!supportsOnlyOfficePreview(document)) {
return false
}
return (
Boolean(options.onlyOfficeLoading) ||
Boolean(options.onlyOfficeAvailable) ||
Boolean(options.onlyOfficeError)
)
}
export function shouldRenderOnlyOfficeHost(document, options = {}) {
if (!supportsOnlyOfficePreview(document)) {
return false
}
return (
Boolean(options.onlyOfficeLoading) ||
Boolean(options.onlyOfficeAvailable) ||
Boolean(options.onlyOfficeError)
)
}
export function resolveKnowledgePreviewMode(document, options = {}) {
if (!document) {
return 'none'