D
@huanlin/dsh-plugin-better-sidebar-plugin-office
v0.1.0 · 4 天前发布
DSH web plugin: Office file previewers (.docx/.xlsx/.pptx) for the better-sidebar editor. Registers the docx/xlsx/pptx file viewers through ctx.betterSidebar.registerFileViewer, keeping the heavy Office render libraries (docx-preview / Univer / SheetJS /
README
dsh-better-sidebar-plugin-office
DSH web 插件:为 better-sidebar 的编辑器提供 Office 三件套文件预览(.docx / .xlsx / .pptx)。
背景
better-sidebar 曾内置这三个 viewer,但 docx-preview / Univer(+ SheetJS)/ pptx-renderer 会把 client bundle 撑到约 23MB。本插件把它们拆成独立 bundle,better-sidebar 本体不再内联 Office 渲染库(约 5.9MB 全套 → 2.2MB 压缩),需要 Office 预览的用户单独安装本插件即可。
功能
ctx.betterSidebar.registerFileViewer 注册 3 个 viewer(id 与内置一致):-
docx:.docx,docx-preview 保真渲染(样式/图片/表格,Alt+滚轮缩放)-
xlsx:.xlsx,Univer sheets 预设(数据 + 公式 + 合并单元格 + 列宽/行高)-
pptx:.pptx,@aiden0z/pptx-renderer 浏览器原生预览(翻页导航)mediaUrl 策略、priority 0、title/icon),因此:- 既有文件路由行为不变(扩展名匹配优先于 binary-download / code 兜底)
- Side card 设置页自动显示这三个 viewer 的启用开关
- 加载/渲染失败回退到「下载查看」链接
版本兼容矩阵
| DSH 版本 | 状态 | 说明 |
|---|---|---|
dsh@0.1.0-rc.6 | ✅ 兼容 | cordis patch ✅ |
dsh@0.1.0 | ✅ 兼容 | 标准 patch ✅ |
dsh@0.2.0 | ⚠️ 待验证 | 待实测(API 可能在变) |
dsh@0.3.0+ | ❓ 未知 | 尚未发布 |
💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正
元数据
- License
- AGPL-3.0
- npm
- @huanlin/dsh-plugin-better-sidebar-plugin-office
- Repo
- —
- Engines
{"node":">=20"}- Weekly DL
- 0
- Monthly DL
- 0
- dsh.bundle
{"bundle":{"patch":"./cordis.patch.yml"},"client":{"inject":["@deepseek-ai/dsh-client-runtime"],"platform":"web"}}