Files
mnote/design/05-editor-mainline/process/5-17-resource-editor-kind-and-smoke-matrix-checklist-v1.md
T

2.8 KiB
Raw Blame History

5-17 Resource Editor Kind 与 Smoke 矩阵 Checklist v1

状态:process

日期:2026-05-20

Owner:资源打开 resolver / Office / Markdown/Text/Code/Image/PDF smoke

1. 目标

把资源类型识别和打开策略从分散 if/else 收口为轻量 resolver,并补齐当前缺失的类型 smoke。默认目标是主编辑区 resource tab;右侧边栏和新窗口必须作为显式目标保留。

2. 允许修改范围

  • rust/crates/mnote-web/src/routes/web_shell.rs
  • rust/crates/mnote-web/src/ssr/pages/layout.rs
  • rust/crates/mnote-web/src/ssr/styles.rs
  • rust/crates/mnote-web/src/routes/onlyoffice.rs
  • scripts/task457-main-editor-resource-tab-smoke.js
  • scripts/task459-local-markdown-attachment-tab-smoke.js
  • 可新增 resource kind smoke

3. Checklist

  • 定义轻量 resource editor resolver
    • 输入:namemimeTypehrefassetIdrootUripathopenTarget
    • 输出:editorKindbadgeKinddefaultOpenModeeditableviewerUrl
  • .md / .markdown / .txt / 常见 code 文件继续使用 tiptap resource editor。
  • Office 文件默认在主编辑区 tab 内 iframe 打开,显式新窗口仍可打开。
  • PDF 使用独立 pdf badge kind,不再复用 ppt。
  • image 使用 image badge kind 和 img viewer。
  • unknown file 有明确 fallback:下载/新窗口/错误占位,不应无响应。
  • active-tabsidenew-window 三个 target 在同一 resolver 后执行,不再散落在 attachment capture 与 filetree click 中。

4. Smoke 矩阵

  • .md 上传/文件树点击 -> 主编辑区 tiptap tab,可编辑并写回资源文件。
  • .txt -> 主编辑区 tiptap tab,可编辑并写回。
  • .json.ts -> 主编辑区 tiptap/code-like tab,可编辑并写回。
  • .docx -> 主编辑区 Office iframeDocumentServer 可回源。
  • .pptx / .xlsx -> badge 颜色分别正确。
  • .pdf -> 主编辑区 iframebadge 为 pdf 独立颜色。
  • image -> 主编辑区 img viewer。
  • unknown binary -> 明确 fallback,不破坏 page tab 切换。

4.1 本轮执行记录

  • 已合入:PDF 独立 badge kind、file fallback badge、resource kind smoke 覆盖 markdown/text/code/image/pdf 与未知类型不破坏 tab 回退。
  • 已验证:scripts/task461-resource-kind-smoke.jsuploaded_attachment_rows_use_colored_file_badges 通过。
  • 未完成:正式 resource editor resolver 抽象、Office DocumentServer 回源修复、active-tab / side / new-window 统一 resolver 后执行。

5. 非目标

  • 不引入 Monaco / CodeMirror。
  • 不实现云端资源写回。
  • 不重构 OnlyOffice DocumentServer 部署。
  • 不改变 .md 资源仍用 tiptap 编辑的产品口径。