Files
mnote/.codex/reasonix-tasks/2026-05-25-batch-f-worker-a-5-29-block-menu-layout.md
T

66 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 F / Worker A5-29 block menu layout helper 候选
Project root`/mnt/Data1T/mnote-worktrees/0525-f-worker-a-5-29-block-menu-layout`
## 目标
在独立 worktree 中产出候选 patch,把 `rust/spikes/leptos-tiptap-spike/src/lib.rs` 中 block menu hover / layout 的最小可迁 helper 迁入 `editor_runtime` 子模块,继续减少 `lib.rs` 中 block menu overlay 逻辑。
优先迁出:
- `hover_anchor_top(block)`
- `hover_anchor_transform(block)`
- `block_menu_layout(block)`
如实现边界自然,可新增 `editor_runtime/block_menu_overlay.rs` 或等价命名。不要迁 `pointer_in_handle_corridor``drop_indicator_from_target``drop_indicator_from_point`,因为它们更接近拖拽 hit-test 逻辑。
## 允许修改
- `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_menu_overlay.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` 整个大函数。
- 不迁拖拽 hit-test`pointer_in_handle_corridor``drop_indicator_from_target``drop_indicator_from_point`
- 不改 block menu 行为语义,不回退 history-safe delete。
- 不修改 AGENTS、design、bugs 或 git 状态。
- 不提交 git。
## 实现要求
- 新模块只承接 block menu hover anchor / layout helper,可通过参数注入 `stage_width` / `stage_top` / `stage_left` 等值,也可在模块内调用现有 DOM helper,但必须保持行为同构。
- 如果引入参数化 helper`lib.rs` 保留 DOM 查询,模块只做几何计算优先。
- 保持 `BlockMenuLayout``HoveredBlockState``block_hover_state.rs` 读取。
- 不新增对 Leptos 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 必须列出:
- 修改文件。
- 迁出的 helper 和未迁出的边界。
- 为什么不会破坏 block menu delete undo / drag reorder。
- 验收命令和结果。
- 浏览器 smoke 证据路径。
- 未覆盖风险。
- `git diff --stat`