# 5-17 Resource Editor Kind 与 Smoke 矩阵 Checklist v1 > 状态:done > > 归档说明(2026-05-21):资源 editor kind 与 smoke 矩阵已完成;resolver 与 OnlyOffice 回源后续由 `5-19` 覆盖并归档。 > > 日期: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: - [ ] 输入:`name`、`mimeType`、`href`、`assetId`、`rootUri`、`path`、`openTarget`。 - [ ] 输出:`editorKind`、`badgeKind`、`defaultOpenMode`、`editable`、`viewerUrl`。 - [x] `.md` / `.markdown` / `.txt` / 常见 code 文件继续使用 tiptap resource editor。 - [ ] Office 文件默认在主编辑区 tab 内 iframe 打开,显式新窗口仍可打开。 - [x] PDF 使用独立 `pdf` badge kind,不再复用 ppt。 - [x] image 使用 image badge kind 和 img viewer。 - [x] unknown file 有明确 fallback:下载/新窗口/错误占位,不应无响应。 - [ ] `active-tab`、`side`、`new-window` 三个 target 在同一 resolver 后执行,不再散落在 attachment capture 与 filetree click 中。 ## 4. Smoke 矩阵 - [x] `.md` 上传/文件树点击 -> 主编辑区 tiptap tab,可编辑并写回资源文件。 - [x] `.txt` -> 主编辑区 tiptap tab,可编辑并写回。 - [x] `.json` 或 `.ts` -> 主编辑区 tiptap/code-like tab,可编辑并写回。 - [ ] `.docx` -> 主编辑区 Office iframe,DocumentServer 可回源。 - [ ] `.pptx` / `.xlsx` -> badge 颜色分别正确。 - [x] `.pdf` -> 主编辑区 iframe,badge 为 pdf 独立颜色。 - [x] image -> 主编辑区 img viewer。 - [x] 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.js` 与 `uploaded_attachment_rows_use_colored_file_badges` 通过。 - 未完成:正式 resource editor resolver 抽象、Office DocumentServer 回源修复、`active-tab` / `side` / `new-window` 统一 resolver 后执行。 ## 5. 非目标 - 不引入 Monaco / CodeMirror。 - 不实现云端资源写回。 - 不重构 OnlyOffice DocumentServer 部署。 - 不改变 `.md` 资源仍用 tiptap 编辑的产品口径。