Files
mnote/.codex/reasonix-tasks/2026-05-25-batch-d-worker-a-5-29-focus-runtime.md
T

2.6 KiB
Raw Blame History

Reasonix Batch D / Worker A5-29 editor focus helper 模块化候选

Project root/mnt/Data1T/mnote-worktrees/0525-d-worker-a-5-29-focus-runtime

目标

在独立 worktree 中产出候选 patch,把 rust/spikes/leptos-tiptap-spike/src/lib.rs 中焦点相关 helper 的最小可迁部分迁入 editor_runtime 子模块,继续推进 5-28 后续收口。

优先迁出:

  • schedule_editor_focus(editor)
  • active_editor_stage()
  • 如有必要,可新增 body_has_focus() 或同等私有 helper

允许修改

  • 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/editor_focus.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

禁止事项

  • 不修改 3-20 / mnote-web 上传 runtime。
  • 不迁 sync_editor_overlay_state / try_sync_editor_overlay_state 整个大函数。
  • 不改 block menu 行为语义,不回退 history-safe delete。
  • 不修改 AGENTS、design、bugs 或 git 状态。
  • 不提交 git。

实现要求

  • 新模块必须只承接焦点/active editor DOM 判断,不承接 overlay signal、block menu signal、selection payload 或 host bridge 事件。
  • active_editor_stage 迁出后仍应使用当前 EDITOR_STAGE_SELECTOR / editor root 判断语义;可通过参数传入 selectors 或通过小型 provider/helper 避免硬编码重复。
  • 保持 task489 的删除后立即 Ctrl+Z 行为不回归。

验收命令

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。
  • 验收命令和结果。
  • 浏览器 smoke 证据路径。
  • 未覆盖风险。
  • git diff --stat