DeepSHPlugins
dsh-plugin-better-sidebar-plugin-office 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-plugin-better-sidebar-plugin-office

UI 增強JavaScript

為 better-sidebar 編輯器提供 Office 三件套檔案預覽(.docx / .xlsx / .pptx):把 docx-preview、Univer 與 pptx-renderer 拆成獨立 bundle,避免撐大 client bundle(全套約 23MB 按需安裝)。

43 StarsHuanLinOTO 更新時間 2026-09-03
訪問 GitHub 倉庫
dsh-plugin-better-sidebar-plugin-office 專案預覽

專案介紹

中文

為 better-sidebar 編輯器提供 Office 三件套檔案預覽(.docx / .xlsx / .pptx):把 docx-preview、Univer 與 pptx-renderer 拆成獨立 bundle,避免撐大 client bundle(全套約 23MB 按需安裝)。

English

Office previews (.docx / .xlsx / .pptx) for the better-sidebar editor — docx-preview, Univer and pptx-renderer split into standalone bundles so the client bundle doesn't bloat (~23MB install on demand).

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
HuanLinOTO
倉庫
HuanLinOTO/dsh-plugin-better-sidebar-plugin-office
GitHub Stars
43
Forks
2
開發語言
JavaScript
許可證
未記錄
最近推送
2026-09-03
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

83/ 100
維護活躍
95
文件與實用資訊
99
生態關注度
49
安裝便捷訊號
100
專案宣告訊號
80

近 8 天仍在更新;README 含完整安裝與使用說明;標準命令一鍵安裝。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin add github:HuanLinOTO/dsh-plugin-better-sidebar-plugin-office

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

dsh-plugin-better-sidebar-plugin-office card

dsh-better-sidebar-plugin-office

npm version

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 浏览器原生预览(翻页导航)
  • viewer 描述符形状与原内置完全一致(mediaUrl 策略、priority 0、title/icon),因此:
  • 既有文件路由行为不变(扩展名匹配优先于 binary-download / code 兜底)
  • Side card 设置页自动显示这三个 viewer 的启用开关
  • 加载/渲染失败回退到「下载查看」链接
  • 客户端组件自包含:自带 locale(中/英)与 CSS,不依赖 better-sidebar 的 client 内部实现

依赖 better-sidebar 版本

需要 better-sidebar >= 0.6.0(已移除内置 office viewer 的版本),否则会与内置 docx/xlsx/pptx 注册冲突(already registered)。

开发

pnpm install
pnpm run typecheck   # 类型门禁(需先构建 DSH-better-sidebar 的 lib/types)
pnpm test            # vitest(xlsx→Univer 转换 + 注册描述符)
pnpm run build       # tsdown 双产物(lib/index.js + lib/client.js)
tsdown.config.ts 含 jszip / xlsx 的 browser-entry alias(SheetJS/JSZip 在 CJS 降级后残留 Node builtin 引用)与 import.meta.resolve 空定义(pptx-renderer 的 PDF.js 探测)。改动这些库版本时需一并验证 client bundle 不含 Node builtin。

安装(profile)

# 从 npm 安装(推荐):
dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office

# 本地开发(link: 热更新)
dsh plugin --profile web add "link:D:/Projects/deepseek-harness/dsh-better-sidebar-plugin-office"

安装后重启 dsh web 进程并浏览器硬刷新(Ctrl+Shift+R)。

运行

  • 打开侧边栏 → 在文件资源管理器中打开任意 .docx / .xlsx / .pptx,预览器自动命中。
  • Side card 设置页 →「文件预览」清单中可见 docx / xlsx / pptx 三张卡片,可单独启用/禁用。

检查

检查项命令预期
类型门禁pnpm run typecheck0 错误
单元测试pnpm test全部通过
构建pnpm run buildlib/client.js 生成,window.__ModuleLoader__.load({ id: '@huanlin/dsh-plugin-better-sidebar-plugin-office', ... }) 包裹
bundle 纯度产物中搜索 node: 或 require("fs")不应出现 Node builtin 引用
profile 可见Test-Path ~/.dsh/profiles/web/node_modules/@huanlin/dsh-plugin-better-sidebar-plugin-office/lib/client.jsTrue
插件加载重启 dsh web + 硬刷新后侧边栏打开 Office 文件预览正常渲染

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案