Files
mnote/.codex/reasonix-tasks/2026-05-25-batch-e-worker-a-5-29-block-hover-state.md
T

67 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Reasonix Batch E / Worker A5-29 block hover state 类型边界候选
Project root`/mnt/Data1T/mnote-worktrees/0525-e-worker-a-5-29-block-hover-state`
## 目标
在独立 worktree 中产出候选 patch,把 `rust/spikes/leptos-tiptap-spike/src/lib.rs` 中 block hover / block menu / drop indicator 的共享状态类型迁入 `editor_runtime` 子模块,为后续拆 `sync_editor_overlay_state`、block menu signal 和拖拽重排逻辑做类型边界准备。
优先迁出类型:
- `HoveredBlockState`
- `BlockMenuLayout`
- `DropPlacement`
- `DropIndicatorState`
必要时可同时迁出只依赖这些类型的极小纯 helper,但不要迁 DOM 查询/事件 listener。
## 允许修改
- `rust/spikes/leptos-tiptap-spike/src/lib.rs`
- `rust/spikes/leptos-tiptap-spike/src/editor_runtime/mod.rs`
- 新增 `rust/spikes/leptos-tiptap-spike/src/editor_runtime/block_hover_state.rs`
如 Rust island 源码变更并需要浏览器验证,可更新:
- `rust/spikes/leptos-tiptap-spike/generated/island/mnote-leptos-tiptap-spike-island.js`
- `rust/spikes/leptos-tiptap-spike/generated/island/mnote-leptos-tiptap-spike-island_bg.wasm`
## 禁止事项
- 不修改 `rust/crates/mnote-web/`
- 不迁 `sync_editor_overlay_state` / `try_sync_editor_overlay_state` 整个大函数。
- 不迁 `hovered_block_from_target``block_state_from_index``block_menu_layout` 等 DOM 查询或布局函数,除非只是为编译所需的类型 import 调整。
- 不改 block menu 行为语义,不回退 history-safe delete。
- 不修改 AGENTS、design、bugs 或 git 状态。
- 不提交 git。
## 实现要求
- 新模块只承接共享状态类型,不承接 Leptos signal、DOM listener、host bridge 或 editor command。
- 如果类型字段需要跨模块访问,使用 `pub(crate)` 字段,保持结构和语义同构。
- `block_menu_document.rs` / `block_menu_legacy_html.rs` 不应继续从 `crate::DropPlacement` 读取;改为从新模块路径 import。
- `lib.rs` 仍保留实际 DOM 计算和 signal 编排。
## 验收命令
```bash
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 rust/spikes/leptos-tiptap-spike/target/wasm32-unknown-unknown/release/mnote_leptos_tiptap_spike.wasm --target web --out-dir rust/spikes/leptos-tiptap-spike/generated/island --out-name mnote-leptos-tiptap-spike-island
NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js
NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js
```
## 输出要求
handoff 必须列出:
- 修改文件。
- 迁出的类型和未迁出的函数边界。
- 为什么不会破坏 block menu delete undo / drag reorder。
- 验收命令和结果。
- 浏览器 smoke 证据路径。
- 未覆盖风险。
- `git diff --stat`