跳到正文

HuanLinOTO/dsh-plugin-better-sidebar-plugin-office

120最近提交 2026年8月15日

dsh-plugin-better-sidebar-plugin-office DSH 插件

该插件将 Office 渲染库(docx-preview、Univer/SheetJS、pptx-renderer)从 better-sidebar 主包中分离,使压缩后主包减少约 2.2MB。它注册三个文件查看器,与原内置行为完全一致,并自动集成到侧边栏设置页。

如何安装 dsh-plugin-better-sidebar-plugin-office DSH 插件

dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office

复制不会执行命令。安装 dsh-plugin-better-sidebar-plugin-office DSH 插件前请核对仓库和版本。

dsh-plugin-better-sidebar-plugin-office DSH 插件数据来源

dsh-plugin-better-sidebar-plugin-office DSH 插件快照日期:2026年8月16日

discovered

dsh-plugin-better-sidebar-plugin-office DSH 插件能做什么

  • 注册 docx 查看器,使用 docx-preview 进行保真渲染,支持样式、图片、表格和 Alt+滚轮缩放。
  • 注册 xlsx 查看器,使用 Univer sheets 预设,支持数据、公式、合并单元格、列宽/行高。
  • 注册 pptx 查看器,使用 @aiden0z/pptx-renderer 进行浏览器原生预览,带翻页导航。
  • 查看器描述符与原内置完全一致,文件路由、优先级、侧边栏设置卡自动生效。
  • 客户端组件自带中英文 locale 和 CSS,不依赖 better-sidebar 内部实现。
  • 渲染失败时回退到“下载查看”链接。

dsh-plugin-better-sidebar-plugin-office DSH 插件适合哪些场景

  • 在 better-sidebar 文件资源管理器中直接预览 Word 文档。
  • 查看包含公式和合并单元格的 Excel 电子表格。
  • 在侧边栏中浏览 PowerPoint 演示文稿,支持翻页。
  • 在侧边栏设置页中单独启用或禁用某个 Office 预览器。
  • 按需加载 Office 渲染能力,减少 better-sidebar 主包体积。

dsh-plugin-better-sidebar-plugin-office DSH 插件适合谁

  • 使用 DSH web 并安装了 better-sidebar 插件、需要预览 Office 文件的用户。
  • 希望保持 DSH profile 精简、仅在需要时加载 Office 预览的开发者。

dsh-plugin-better-sidebar-plugin-office DSH 插件的限制

  • 需要 better-sidebar >= 0.6.0,否则会与内置 viewer 产生注册冲突。
  • 仅在 DSH web 环境下作为 better-sidebar 的扩展运行。
  • 客户端 bundle 可能包含 jszip、xlsx 等依赖,构建后需验证没有 Node builtin 引用。

dsh-plugin-better-sidebar-plugin-office DSH 插件的仓库 README 摘录

以下文字摘自 dsh-plugin-better-sidebar-plugin-office DSH 插件的上游仓库 HuanLinOTO/dsh-plugin-better-sidebar-plugin-office 的 README,版权归原作者,仅作引用。

> 📌 本插件已收录于 [dshfind](https://dshfind.com/zh) 插件超市,点击上方徽章直达主页。 # dsh-better-sidebar-plugin-office [![npm version](https://img.shields.io/npm/v/@huanlin/dsh-plugin-better-sidebar-plugin-office)](https://www.npmjs.com/package/@huanlin/dsh-plugin-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 浏览器原生预览(翻页导航) - 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`)。 ## 开发

阅读完整 README仓库许可: NOASSERTION

dsh-plugin-better-sidebar-plugin-office DSH 插件常见问题

如何安装这个插件?

在终端中执行 `dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office`,然后重启 `dsh web` 进程并浏览器硬刷新(Ctrl+Shift+R)。

支持哪些文件格式?

支持 .docx(Word)、.xlsx(Excel)和 .pptx(PowerPoint)三种常见的 Office 文档格式。

需要什么版本的 better-sidebar?

需要 better-sidebar 0.6.0 或更高版本。旧版本内置了 Office 查看器,会导致本插件注册时提示“already registered”。

可以单独禁用某个预览器吗?

可以。打开侧边栏设置页,在“文件预览”区域会看到 docx、xlsx、pptx 三张卡片,可以分别开关。

渲染失败怎么办?

如果文件渲染失败,插件会显示“下载查看”链接,点击后下载文件,再用桌面 Office 软件打开。