refactor: extract block menu overlay close helper
This commit is contained in:
@@ -140,7 +140,10 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 修改:`rust/crates/mnote-web/browser/filetree-runtime.js`、`rust/crates/mnote-web/src/ssr/pages/layout.rs`。
|
||||
- 已验证:`node --check rust/crates/mnote-web/browser/filetree-runtime.js`、`cargo fmt --manifest-path rust/Cargo.toml --all --check`、`cargo check --manifest-path rust/Cargo.toml -p mnote-web`、`cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime -- --test-threads=1`、`cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_upload_runtime_routes_local_markdown_assets_to_local_folder -- --test-threads=1`、`NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`。
|
||||
- 未完成:`refreshLocalFolderSidebarSnapshot`、async preflight、`acceptDiskVersion` / `keepCurrentEditorVersion` / `writeMergedConflictResult` 业务逻辑、document session lifecycle、secondary pane conflict smoke 仍未迁出或覆盖。
|
||||
- 2026-05-25:Batch J 启动 Worker C(`0525-j-worker-c-3-20-filetree-dom`)与 Worker D(`0525-j-worker-d-3-20-conflict-action`),并同时存在 5-29 Worker B,3 个 worker 超过当前 goal 的“每批最多 2 个 worker”。Reasonix run `reasonix-2026-05-24T19-14-46-740Z-b6aed1df`、`reasonix-2026-05-24T19-14-46-748Z-c84c5ef9` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md`、`result.json`、`process-handoff.md/json`,worktree diff 为空;不采纳。
|
||||
- 2026-05-25:Batch J 启动 Worker C(`0525-j-worker-c-3-20-filetree-dom`)与 Worker D(`0525-j-worker-d-3-20-conflict-action`),并同时存在 5-29 Worker B,3 个 worker 超过当前 goal 的“每批最多 2 个 worker”。Reasonix run `reasonix-2026-05-24T19-14-46-740Z-b6aed1df`、`reasonix-2026-05-24T19-14-46-748Z-c84c5ef9` 仅有 `prompt.md` / `memory-recall.json`,无 `final.md`、`result.json`、`process-handoff.md/json`,worktree diff 为空;不采纳。
|
||||
- 2026-05-25:Batch J Codex 复核结论:Worker C / D 对应边界已在当前 HEAD 中具备,未重复合入新 diff。Worker C 已验证 `node --check rust/crates/mnote-web/browser/filetree-runtime.js`、`cargo check --manifest-path rust/Cargo.toml -p mnote-web`、`cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_runtime_contains_row_accessor_helpers -- --test-threads=1`;Worker D 已验证 `node --check rust/crates/mnote-web/browser/document-conflict-panel-runtime.js`、`cargo check --manifest-path rust/Cargo.toml -p mnote-web`、`cargo test --manifest-path rust/Cargo.toml -p mnote-web document_conflict_panel_runtime_contains_dom_helpers -- --test-threads=1`。
|
||||
- 主工作区 smoke:`NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js` 通过,截图证据 `/tmp/mnote-task479-lifecycle-xlAZrs/screenshots-1779650673787/final-state.png`;`NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task451-local-markdown-conflict-resolution-ui-smoke.js` 通过,结果 `/mnt/Data1T/mnote/tmp/task451-local-markdown-conflict-resolution-ui-smoke/result.json`。
|
||||
- 2026-05-25:当前 goal 已收紧为每批最多 2 个 worker;后续 3-20 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次只作为已发生事实保留,不作为后续口径。
|
||||
- 2026-05-25:当前 goal 明确为每批最多 2 个 worker;后续 3-20 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次保留为异常记录。
|
||||
- 2026-05-25:Batch L Worker B `reasonix-2026-05-24T19-30-30-509Z-18f62949` 只读审计 `refreshLocalFolderSidebarSnapshot`;Codex 已读取 Hindsight recall、`process-handoff.md/json`、`result.json`,并核对 worktree diff 为空。
|
||||
- 审计结论:`refreshLocalFolderSidebarSnapshot` 仍是 shell 编排,包含 workspace/root/document 状态、两条 projection fetch、render 后副作用和 watcher 标记,不应整体迁入 `filetree-runtime.js`。
|
||||
- 下一刀建议:优先迁投影数据读取器层(如 `readProjection`、`readDatasetProjection`、`projectionItems`、row/id/title/file accessor、`groupRowsByParent`),或更保守地先迁未使用的 `replaceSidebarTreeFromDocument`;Codex 本轮不直接实现 3-20 代码,只记录候选。
|
||||
|
||||
@@ -134,7 +134,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 修改:`rust/spikes/leptos-tiptap-spike/src/lib.rs`、generated island `js/d.ts/wasm/wasm.d.ts`。
|
||||
- 已验证:在独立 worktree 中运行 `cargo fmt --manifest-path rust/Cargo.toml --all --check`、`cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml`、wasm release build、`wasm-bindgen`;主工作区复跑 `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` 均通过,结果分别位于 `/mnt/Data1T/mnote/tmp/task489-block-menu-delete-undo-smoke/result.json`、`/mnt/Data1T/mnote/tmp/task488-local-attachment-link-delete-undo-smoke/result.json`。
|
||||
- 未完成:`try_sync_editor_overlay_state`、`on_selection_change` overlay 同步、block menu signal 编排仍未迁出;本轮未扩大迁移边界。
|
||||
- 2026-05-25:当前 goal 已收紧为每批最多 2 个 worker;后续 Batch 计划和 Reasonix 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次只作为已发生事实保留,不作为后续口径。
|
||||
- 2026-05-25:当前 goal 明确为每批最多 2 个 worker;后续 Batch 计划和 Reasonix 派发以 2 个为硬上限,历史记录中超过 2 个 worker 的批次保留为异常记录。
|
||||
- 2026-05-25:Batch K 只派发 1 个只读 Reasonix worker 审计 `close_editor_floating_overlays` 迁出边界,使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-k-5-29-close-overlays-readonly`,run id `reasonix-2026-05-24T19-18-51-566Z-90f11977`,并显式使用 `--no-memory-recall` 降低任务串线风险。
|
||||
- Codex 已读取 Hindsight recall、`process-handoff.md/json`、`result.json`,并核对 worktree `git status --short` / `git diff --stat` 为空。
|
||||
- 审计结论:先把 `ImageToolbarAnchor`、`TableOverlayAnchor`、`TableSelectionKind`、`TableSelectionOverlayState` 迁入 `editor_runtime/overlays.rs`,再迁出纯 WriteSignal setter `close_editor_floating_overlays`;`close_editor_floating_overlays_if_escape`、`open_slash_menu_overlay`、`open_image_toolbar_overlay`、`open_block_menu_overlay`、`try_sync_editor_overlay_state` 和 `on_selection_change` overlay 同步继续留在 `lib.rs`。
|
||||
@@ -142,3 +142,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 修改:`rust/spikes/leptos-tiptap-spike/src/editor_runtime/overlays.rs`、`rust/spikes/leptos-tiptap-spike/src/lib.rs`、generated island `js/d.ts/wasm/wasm.d.ts`。
|
||||
- 已验证:`cargo fmt --manifest-path rust/Cargo.toml --all --check`、`cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml`、wasm release build、`wasm-bindgen`。主工作区 editor smoke 仍需复跑后再提交。
|
||||
- 未完成:`try_sync_editor_overlay_state`、`on_selection_change` overlay 同步、block menu signal 编排、Escape 条件判断仍未迁出。
|
||||
- 2026-05-25:Batch L 派发 2 个只读 Reasonix worker:Worker A `reasonix-2026-05-24T19-30-30-474Z-c3f28f20` 审计 5-29 overlay sync,Worker B `reasonix-2026-05-24T19-30-30-509Z-18f62949` 审计 3-20 sidebar refresh;运行中又出现两个额外自动 runner,主控已终止,不采纳。
|
||||
- Worker A handoff 出现任务串线迹象,final 同时讨论 3-20 和 5-29;Codex 只采纳其中由本地代码复核确认的 5-29 结论:`on_selection_change` 和 `try_sync_editor_overlay_state` 不能直接统一,因为 toolbar lock 语义不同。
|
||||
- Codex 主控采纳最小机械切片:把 `try_close_block_menu_overlays` 迁入 `editor_runtime/overlays.rs`;`try_sync_editor_overlay_state`、`close_editor_floating_overlays_if_escape` 和 `on_selection_change` 仍留在 `lib.rs`。
|
||||
- 已验证:`cargo fmt --manifest-path rust/Cargo.toml --all --check`、`cargo check --manifest-path rust/spikes/leptos-tiptap-spike/Cargo.toml`、wasm release build、`wasm-bindgen`、`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`。
|
||||
|
||||
BIN
Binary file not shown.
@@ -117,3 +117,28 @@ pub(crate) fn close_editor_floating_overlays(
|
||||
set_block_turn_into_open.set(false);
|
||||
set_block_folded_title_open.set(false);
|
||||
}
|
||||
|
||||
pub(crate) fn try_close_block_menu_overlays(
|
||||
set_slash_open: WriteSignal<bool>,
|
||||
set_turn_into_open: WriteSignal<bool>,
|
||||
set_hovered_block: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_menu_anchor: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_menu_open: WriteSignal<bool>,
|
||||
) -> bool {
|
||||
if set_slash_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_turn_into_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_block_menu_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_block_menu_anchor.try_set(None).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_hovered_block.try_set(None).is_none() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ use editor_runtime::editor_focus::{active_editor_stage, body_has_focus, schedule
|
||||
use editor_runtime::overlays::{
|
||||
close_editor_floating_overlays, floating_toolbar_anchor_from_selection,
|
||||
sync_text_selection_overlay, FloatingToolbarAnchor, ImageToolbarAnchor, TableOverlayAnchor,
|
||||
TableSelectionKind, TableSelectionOverlayState,
|
||||
TableSelectionKind, TableSelectionOverlayState, try_close_block_menu_overlays,
|
||||
};
|
||||
use editor_runtime::persistence::{
|
||||
load_persisted_document, normalize_identity_value, persist_document_state,
|
||||
@@ -5862,31 +5862,6 @@ fn open_block_menu_overlay(
|
||||
should_open
|
||||
}
|
||||
|
||||
fn try_close_block_menu_overlays(
|
||||
set_slash_open: WriteSignal<bool>,
|
||||
set_turn_into_open: WriteSignal<bool>,
|
||||
set_hovered_block: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_menu_anchor: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_menu_open: WriteSignal<bool>,
|
||||
) -> bool {
|
||||
if set_slash_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_turn_into_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_block_menu_open.try_set(false).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_block_menu_anchor.try_set(None).is_none() {
|
||||
return false;
|
||||
}
|
||||
if set_hovered_block.try_set(None).is_none() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn try_sync_editor_overlay_state(
|
||||
set_editor_focused: WriteSignal<bool>,
|
||||
set_text_selection_active: WriteSignal<bool>,
|
||||
|
||||
Reference in New Issue
Block a user