refactor: extract editor overlay close state
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
## 1. 目标
|
||||
|
||||
在 `3-19` 已归档的基础上,继续把仍留在 Rust inline / 主壳大 runtime 中的浏览器行为切成可审计模块。Codex 维护本文件作为事实源,Reasonix 只承接短批次审计、窄范围实现或浏览器 smoke;每批最多 2 个 worker。
|
||||
在 `3-19` 已归档的基础上,继续把仍留在 Rust inline / 主壳大 runtime 中的浏览器行为切成可审计模块。Codex 维护本文件作为事实源,Reasonix 只承接短批次审计、窄范围实现或浏览器 smoke;当前 goal 下每批最多 2 个 worker。
|
||||
|
||||
## 2. 本轮边界
|
||||
|
||||
@@ -124,7 +124,7 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 2026-05-25:Batch E 派发异常并终止:Worker B 任务被重复启动为两个 runner / ACP 进程(`reasonix-2026-05-24T18-25-26-844Z-33ea4d58`、`reasonix-2026-05-24T18-26-04-453Z-5ff62e40`),同一 worktree `/mnt/Data1T/mnote-worktrees/0525-e-worker-b-3-20-conflict-diff-dom` 出现并发写入风险;Codex 已终止相关 Reasonix 进程,未读取到 `final.md`、`result.json`、`process-handoff.md/json`。原始未验证 diff 不直接采纳;后续采纳必须经过 Codex 独立复核、修正和验证。
|
||||
- 2026-05-25:Batch F 计划继续采用独立 worktree 候选 patch:Worker B 负责把 file tree 上传目标解析的纯 fallback / plan 归一化 helper 外置到 `filetree-runtime.js`;`layout.rs` 仍保留 async preflight 和完整 inline fallback,避免和当前 conflict panel 写集冲突。
|
||||
- 2026-05-25:Batch F Worker B 异常终止:run `reasonix-2026-05-24T18-39-34-442Z-d9e7ada1` 只产出 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,未产出 `final.md`、`result.json`、`process-handoff.md/json`,worktree 无 diff;transcript 停在 `ask_choice`,原因是 worker 误判任务书拼接了 Worker A / Worker B 两个任务并要求人工选择。Codex 已终止 runner / ACP,不采纳该 run。
|
||||
- 2026-05-25:Batch G 按用户纠正把 Worker B/C/D 分别派到独立 worktree,但三个 worker 同时启动,超过当前 goal 的“每批最多 2 个 worker”;三个 Reasonix run `reasonix-2026-05-24T18-51-00-477Z-1307a1b4`、`reasonix-2026-05-24T18-51-00-504Z-2304f570`、`reasonix-2026-05-24T18-51-00-541Z-17d61f43` 均只有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 handoff/result/final,worktree 初始 diff 为空;Codex 不采纳这些 Reasonix run,只把独立 worktree 保留为 Codex 候选 patch 沙盒。
|
||||
- 2026-05-25:Batch G 把 Worker B/C/D 分别派到独立 worktree,3 个 worker 超过当前 goal 的“每批最多 2 个 worker”;三个 Reasonix run `reasonix-2026-05-24T18-51-00-477Z-1307a1b4`、`reasonix-2026-05-24T18-51-00-504Z-2304f570`、`reasonix-2026-05-24T18-51-00-541Z-17d61f43` 均只有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 handoff/result/final,worktree 初始 diff 为空;Codex 不采纳这些 Reasonix run,只把独立 worktree 保留为 Codex 候选 patch 沙盒。
|
||||
- 2026-05-25:Codex 主控完成 filetree upload target fallback 小切片:`filetree-runtime.js` 新增并导出 `fileTreeUploadTargetFallback(detail, deps)`,承接同步 fallback / plan 归一化;`layout.rs` 的 `fallbackFileTreeUploadTarget` 优先委托 runtime,仍保留完整 inline fallback;async preflight、后端归属判定、`uploadFileToMediaAsset`、`uploadFilesWithResolvedTarget` 不迁。
|
||||
- 修改:`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 -- --test-threads=1`、`cargo test --manifest-path rust/Cargo.toml -p mnote-web local_upload_runtime_contains_editor_upload_context_helpers -- --test-threads=1`、`NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`。
|
||||
@@ -140,4 +140,7 @@ 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`),并同时存在 Worker B,超过当前 goal 的“每批最多 2 个 worker”;Codex 已终止相关 runner / ACP 进程。三个 run 仅有 `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` / `reasonix-transcript.jsonl`,无 `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 的批次只作为已发生事实保留,不作为后续口径。
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## 1. 目标
|
||||
|
||||
在 `5-28` 已完成附件链接、history-safe delete、command sync、persistence、attachment upload intent 首批拆分后,继续把 editor runtime 的 selection / overlay / block menu / mindmap node view 切成可索引模块。Codex 维护本文件作为事实源,Reasonix 只做短批次审计、窄范围实现或浏览器 smoke;每批最多 2 个 worker。
|
||||
在 `5-28` 已完成附件链接、history-safe delete、command sync、persistence、attachment upload intent 首批拆分后,继续把 editor runtime 的 selection / overlay / block menu / mindmap node view 切成可索引模块。Codex 维护本文件作为事实源,Reasonix 只做短批次审计、窄范围实现或浏览器 smoke;当前 goal 下每批最多 2 个 worker。
|
||||
|
||||
## 2. 本轮边界
|
||||
|
||||
@@ -129,4 +129,16 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- Codex 已读取 Hindsight recall、`process-handoff.md/json`、`result.json`,并核对 worktree `git status --short` / `git diff --stat` 为空。
|
||||
- 审计结论:只迁纯几何 helper 是合理边界;DOM 查询、`document.element_from_point`、event listener、Leptos signal 和拖拽重排行为继续留在 `lib.rs`。
|
||||
- 主控裁决:采纳审计方向,但保留当前 `editor_runtime/block_dnd.rs` 的 `HandleCorridorGeometry` 参数结构,避免 Reasonix 建议的长参数列表降低可读性。
|
||||
- 2026-05-25:Batch J 外部/自动启动 Worker B(`0525-j-worker-b-5-29-close-overlays`),同时还启动了 3-20 Worker C/D,超过当前 goal 的“每批最多 2 个 worker”;Codex 已终止相关 runner / ACP 进程。run `reasonix-2026-05-24T19-14-46-705Z-ebcc8980` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md`、`result.json`、`process-handoff.md/json`,worktree diff 为空;不采纳。
|
||||
- 2026-05-25:Batch J 同时启动 Worker B(`0525-j-worker-b-5-29-close-overlays`)和 3-20 Worker C/D,3 个 worker 超过当前 goal 的“每批最多 2 个 worker”。Reasonix run `reasonix-2026-05-24T19-14-46-705Z-ebcc8980` 仅有 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,无 `final.md`、`result.json`、`process-handoff.md/json`,worktree diff 为空;不采纳。
|
||||
- 2026-05-25:Batch J Codex 在独立 worktree `/mnt/Data1T/mnote-worktrees/0525-j-worker-b-5-29-close-overlays` 产出并复核候选 patch:删除无调用方的 `sync_editor_overlay_state`,新增 `try_close_block_menu_overlays` 承接 `try_sync_editor_overlay_state` 中的 slash / turn-into / block menu / hovered block 关闭子集;不迁 `try_sync_editor_overlay_state`,不合并 `on_selection_change` 的内联 overlay 路径。
|
||||
- 修改:`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: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`。
|
||||
- Codex 主控在主工作区采纳该边界,并保留 Batch J 候选中已复核过的 `try_close_block_menu_overlays` 小 helper;该 helper 只收窄 `try_sync_editor_overlay_state` 内部的 block menu 关闭子集,不迁出 signal 编排。
|
||||
- 修改:`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 条件判断仍未迁出。
|
||||
|
||||
BIN
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
use leptos::prelude::{Set, WriteSignal};
|
||||
|
||||
use crate::{
|
||||
editor_runtime::block_hover_state::HoveredBlockState,
|
||||
editor_runtime::dom_selection::active_editor_text_selection, editor_stage_element,
|
||||
};
|
||||
|
||||
@@ -10,6 +11,44 @@ pub(crate) struct FloatingToolbarAnchor {
|
||||
pub(crate) left: f64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) struct ImageToolbarAnchor {
|
||||
pub(crate) top: f64,
|
||||
pub(crate) left: f64,
|
||||
pub(crate) align: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(crate) struct TableOverlayAnchor {
|
||||
pub(crate) top: f64,
|
||||
pub(crate) left: f64,
|
||||
pub(crate) width: f64,
|
||||
pub(crate) height: f64,
|
||||
pub(crate) rows: usize,
|
||||
pub(crate) cols: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum TableSelectionKind {
|
||||
Row,
|
||||
Column,
|
||||
}
|
||||
|
||||
impl TableSelectionKind {
|
||||
pub(crate) fn id(self) -> &'static str {
|
||||
match self {
|
||||
Self::Row => "row",
|
||||
Self::Column => "column",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(crate) struct TableSelectionOverlayState {
|
||||
pub(crate) kind: TableSelectionKind,
|
||||
pub(crate) index: usize,
|
||||
}
|
||||
|
||||
pub(crate) fn floating_toolbar_anchor_from_selection() -> Option<FloatingToolbarAnchor> {
|
||||
let selection = active_editor_text_selection()?;
|
||||
let range = selection.get_range_at(0).ok()?;
|
||||
@@ -37,3 +76,44 @@ pub(crate) fn sync_text_selection_overlay(
|
||||
set_floating_toolbar_anchor.set(toolbar_anchor);
|
||||
has_text_selection
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn close_editor_floating_overlays(
|
||||
set_slash_open: WriteSignal<bool>,
|
||||
set_slash_index: WriteSignal<usize>,
|
||||
set_slash_query: WriteSignal<String>,
|
||||
set_turn_into_open: WriteSignal<bool>,
|
||||
set_color_menu_open: WriteSignal<bool>,
|
||||
set_more_menu_open: WriteSignal<bool>,
|
||||
set_locked_toolbar_anchor: WriteSignal<Option<FloatingToolbarAnchor>>,
|
||||
set_text_selection_active: WriteSignal<bool>,
|
||||
set_floating_toolbar_anchor: WriteSignal<Option<FloatingToolbarAnchor>>,
|
||||
set_image_toolbar_anchor: WriteSignal<Option<ImageToolbarAnchor>>,
|
||||
set_table_toolbar_open: WriteSignal<bool>,
|
||||
set_table_options_open: WriteSignal<bool>,
|
||||
set_table_overlay_anchor: WriteSignal<Option<TableOverlayAnchor>>,
|
||||
set_table_selection_overlay: WriteSignal<Option<TableSelectionOverlayState>>,
|
||||
set_block_menu_open: WriteSignal<bool>,
|
||||
set_block_menu_anchor: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_turn_into_open: WriteSignal<bool>,
|
||||
set_block_folded_title_open: WriteSignal<bool>,
|
||||
) {
|
||||
set_slash_open.set(false);
|
||||
set_slash_index.set(0);
|
||||
set_slash_query.set(String::new());
|
||||
set_turn_into_open.set(false);
|
||||
set_color_menu_open.set(false);
|
||||
set_more_menu_open.set(false);
|
||||
set_locked_toolbar_anchor.set(None);
|
||||
set_text_selection_active.set(false);
|
||||
set_floating_toolbar_anchor.set(None);
|
||||
set_image_toolbar_anchor.set(None);
|
||||
set_table_toolbar_open.set(false);
|
||||
set_table_options_open.set(false);
|
||||
set_table_overlay_anchor.set(None);
|
||||
set_table_selection_overlay.set(None);
|
||||
set_block_menu_open.set(false);
|
||||
set_block_menu_anchor.set(None);
|
||||
set_block_turn_into_open.set(false);
|
||||
set_block_folded_title_open.set(false);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ use editor_runtime::dom_selection::{
|
||||
};
|
||||
use editor_runtime::editor_focus::{active_editor_stage, body_has_focus, schedule_editor_focus};
|
||||
use editor_runtime::overlays::{
|
||||
floating_toolbar_anchor_from_selection, sync_text_selection_overlay, FloatingToolbarAnchor,
|
||||
close_editor_floating_overlays, floating_toolbar_anchor_from_selection,
|
||||
sync_text_selection_overlay, FloatingToolbarAnchor, ImageToolbarAnchor, TableOverlayAnchor,
|
||||
TableSelectionKind, TableSelectionOverlayState,
|
||||
};
|
||||
use editor_runtime::persistence::{
|
||||
load_persisted_document, normalize_identity_value, persist_document_state,
|
||||
@@ -4789,44 +4791,6 @@ fn build_command_listener(mount_id: u32) -> Closure<dyn FnMut(Event)> {
|
||||
}))
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct ImageToolbarAnchor {
|
||||
top: f64,
|
||||
left: f64,
|
||||
align: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
struct TableOverlayAnchor {
|
||||
top: f64,
|
||||
left: f64,
|
||||
width: f64,
|
||||
height: f64,
|
||||
rows: usize,
|
||||
cols: usize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum TableSelectionKind {
|
||||
Row,
|
||||
Column,
|
||||
}
|
||||
|
||||
impl TableSelectionKind {
|
||||
fn id(self) -> &'static str {
|
||||
match self {
|
||||
Self::Row => "row",
|
||||
Self::Column => "column",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
struct TableSelectionOverlayState {
|
||||
kind: TableSelectionKind,
|
||||
index: usize,
|
||||
}
|
||||
|
||||
fn default_title() -> String {
|
||||
"Leptos Tiptap 主编辑器 P0".to_string()
|
||||
}
|
||||
@@ -5692,46 +5656,6 @@ fn toolbar_overlay_locked(
|
||||
turn_into_open || color_menu_open || more_menu_open
|
||||
}
|
||||
|
||||
fn close_editor_floating_overlays(
|
||||
set_slash_open: WriteSignal<bool>,
|
||||
set_slash_index: WriteSignal<usize>,
|
||||
set_slash_query: WriteSignal<String>,
|
||||
set_turn_into_open: WriteSignal<bool>,
|
||||
set_color_menu_open: WriteSignal<bool>,
|
||||
set_more_menu_open: WriteSignal<bool>,
|
||||
set_locked_toolbar_anchor: WriteSignal<Option<FloatingToolbarAnchor>>,
|
||||
set_text_selection_active: WriteSignal<bool>,
|
||||
set_floating_toolbar_anchor: WriteSignal<Option<FloatingToolbarAnchor>>,
|
||||
set_image_toolbar_anchor: WriteSignal<Option<ImageToolbarAnchor>>,
|
||||
set_table_toolbar_open: WriteSignal<bool>,
|
||||
set_table_options_open: WriteSignal<bool>,
|
||||
set_table_overlay_anchor: WriteSignal<Option<TableOverlayAnchor>>,
|
||||
set_table_selection_overlay: WriteSignal<Option<TableSelectionOverlayState>>,
|
||||
set_block_menu_open: WriteSignal<bool>,
|
||||
set_block_menu_anchor: WriteSignal<Option<HoveredBlockState>>,
|
||||
set_block_turn_into_open: WriteSignal<bool>,
|
||||
set_block_folded_title_open: WriteSignal<bool>,
|
||||
) {
|
||||
set_slash_open.set(false);
|
||||
set_slash_index.set(0);
|
||||
set_slash_query.set(String::new());
|
||||
set_turn_into_open.set(false);
|
||||
set_color_menu_open.set(false);
|
||||
set_more_menu_open.set(false);
|
||||
set_locked_toolbar_anchor.set(None);
|
||||
set_text_selection_active.set(false);
|
||||
set_floating_toolbar_anchor.set(None);
|
||||
set_image_toolbar_anchor.set(None);
|
||||
set_table_toolbar_open.set(false);
|
||||
set_table_options_open.set(false);
|
||||
set_table_overlay_anchor.set(None);
|
||||
set_table_selection_overlay.set(None);
|
||||
set_block_menu_open.set(false);
|
||||
set_block_menu_anchor.set(None);
|
||||
set_block_turn_into_open.set(false);
|
||||
set_block_folded_title_open.set(false);
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn close_editor_floating_overlays_if_escape(
|
||||
slash_open: ReadSignal<bool>,
|
||||
@@ -5938,28 +5862,29 @@ fn open_block_menu_overlay(
|
||||
should_open
|
||||
}
|
||||
|
||||
fn sync_editor_overlay_state(
|
||||
set_editor_focused: WriteSignal<bool>,
|
||||
set_text_selection_active: WriteSignal<bool>,
|
||||
set_floating_toolbar_anchor: WriteSignal<Option<FloatingToolbarAnchor>>,
|
||||
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>,
|
||||
) {
|
||||
let focused = active_editor_stage();
|
||||
set_editor_focused.set(focused);
|
||||
let has_text_selection =
|
||||
sync_text_selection_overlay(set_text_selection_active, set_floating_toolbar_anchor);
|
||||
|
||||
if focused && has_text_selection {
|
||||
set_slash_open.set(false);
|
||||
set_turn_into_open.set(false);
|
||||
set_block_menu_open.set(false);
|
||||
set_block_menu_anchor.set(None);
|
||||
set_hovered_block.set(None);
|
||||
) -> 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(
|
||||
@@ -5993,19 +5918,13 @@ fn try_sync_editor_overlay_state(
|
||||
}
|
||||
|
||||
if focused && has_text_selection {
|
||||
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() {
|
||||
if !try_close_block_menu_overlays(
|
||||
set_slash_open,
|
||||
set_turn_into_open,
|
||||
set_hovered_block,
|
||||
set_block_menu_anchor,
|
||||
set_block_menu_open,
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user