refactor: extract editor action modules

This commit is contained in:
lix-2026
2026-05-25 19:50:50 +08:00
parent 7d5319606c
commit 4537b1a3d6
9 changed files with 536 additions and 509 deletions
@@ -186,7 +186,7 @@ codegraph sync .
|----|------|
| SIDEBAR_TREE_JS 外置 | 布局文件从 11,741 → ~1,100 行 |
| browser/ 模块 | 11 个 JS 文件,总计 ~11,000 行 |
| editor_runtime/ 模块 | 16 个 Rust 模块(另有 mod.rs |
| editor_runtime/ 模块 | 19 个 Rust 模块(另有 mod.rs |
| 浏览器 smoke | task479/488/489/451 全部 PASS |
| 测试 | editor 13/13, web sidebar 10/10, web full 531/549 |
| CodeGraph | 350+ 文件索引完成 |
@@ -195,4 +195,4 @@ codegraph sync .
| 项 | 说明 |
|----|------|
| Batch C 全量验证 | 尚未运行 `cargo test -p mnote-web --lib` / `cargo test -p mnote-leptos-tiptap-spike` / task451 全套;本轮已完成 spike check/build、wasm-bindgen、task479/task488/task489 与直接编辑器交互回归 |
| Batch C 全量验证 | 尚未运行 `cargo test -p mnote-web --lib` / `cargo test -p mnote-leptos-tiptap-spike` / task451 全套;本轮已完成 spike check/build、wasm-bindgen、task479/task488/task489、临时 slash/table Playwright 回归与直接编辑器交互回归 |
@@ -406,11 +406,14 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
| 文件 | 原大小 | 现大小 | 变化 |
|------|--------|--------|------|
| `lib.rs` | 9,873 行 | 8,671 行 | **-12%** |
| `lib.rs` | 9,873 行 | 8,181 行 | **-17%** |
| `editor_runtime/mindmap_node_view.rs` | — | 909 行 | 新建 |
| `editor_runtime/bridge_events.rs` | — | 149 行 | 新建 |
| `editor_runtime/slash_actions.rs` | — | 237 行 | 新建 |
| `editor_runtime/table_commands.rs` | — | 180 行 | 新建 |
| `editor_runtime/bridge_dispatch.rs` | — | 86 行 | 新建 |
### editor_runtime/ 最终模块清单(16 模块,另有 `mod.rs`
### editor_runtime/ 最终模块清单(19 模块,另有 `mod.rs`
| 模块 | 说明 | 来源 |
|------|------|------|
@@ -420,6 +423,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
| `block_hover_state.rs` | HoveredBlockState 共享类型 | 5-29 |
| `block_menu_document.rs` | legacy JSON helper | 5-29 |
| `block_menu_overlay.rs` | block menu 几何 | 5-29 |
| `bridge_dispatch.rs` | host command kind 解析 | **本批新建** |
| `bridge_events.rs` | 事件常量 + payload 类型 | **本批新建** |
| `command_sync.rs` | 命令同步 | 5-28 P2 |
| `content_layout.rs` | 内容布局 | 5-29 |
@@ -430,6 +434,8 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
| `mindmap_node_view.rs` | mindmap shell 完整实现 | **本批新建**5-28 P5 |
| `overlays.rs` | overlay 管理 | 5-29 |
| `persistence.rs` | 持久化 | 5-28 P2 |
| `slash_actions.rs` | slash 菜单 action 数据 | **本批新建** |
| `table_commands.rs` | table toolbar / option 命令 | **本批新建** |
### 未完成(后续独立任务)
@@ -448,3 +454,8 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
- 拖拽重排两条路径与块菜单“拷贝副本”不再读取/写回整文 HTML,改为 `move_top_level_block_with_history` / `duplicate_top_level_block_with_history` + `sync_persisted_editor_command`
- 删除本轮变成无调用方的 `block_menu_legacy_html.rs``apply_html_update`generated island JS/WASM 已重新生成。
- 已验证:`cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml``cargo build --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml --target wasm32-unknown-unknown --release``wasm-bindgen --target web --out-dir rust/spikes/leptos-tiptap-spike/generated/island --out-name mnote-leptos-tiptap-spike-island rust/spikes/leptos-tiptap-spike/target/wasm32-unknown-unknown/release/mnote_leptos_tiptap_spike.wasm``task489``task488``task479`、临时 Playwright 拷贝副本 undo/redo + 块拖拽重排回归。
- 2026-05-25Codex 继续完成低风险模块提取。
- 新增 `slash_actions.rs`,迁出 `SlashActionKind` / `SlashAction` / `SLASH_ACTIONS``lib.rs` 继续持有 slash 命令执行与 Leptos view。
- 新增 `table_commands.rs`,迁出 table toolbar / option action、命令执行和 checked 状态计算。
- 新增 `bridge_dispatch.rs`,迁出 `HostCommandKind` 及 host command payload 解析;真实 command 执行 match 仍留在 `lib.rs`
- 已验证:`cargo fmt --manifest-path rust/Cargo.toml --all --check``cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml``cargo test --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml command -- --test-threads=1`、wasm release build、`wasm-bindgen`、task489、task488、task479、临时 slash 插入简单表格 + 表格行 aux 命令 Playwright 回归。