refactor: share editor content layout helpers
This commit is contained in:
@@ -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;当前 goal 下每批最多 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 下每批最多 4 个 worker。
|
||||
|
||||
## 2. 本轮边界
|
||||
|
||||
@@ -341,7 +341,10 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 2026-05-25:Batch BE 由 Codex 主控为 `5-29` 侧追加 1 个独立 worktree 只读审计 worker `/mnt/Data1T/mnote-worktrees/0525-be-worker-d-5-29-layout-constant-readonly`。
|
||||
- 目标:不再复述 `slash_menu_anchor_style()` fallback,而是只回答 `content_text_left()` / 内容列布局常量 是否值得作为下一刀独立 design 或只读收口主题。
|
||||
- 约束:任务书写入该 worktree `tmp/`;禁止修改源码、禁止 `.codex/reasonix-tasks/*`、禁止子 agent。Codex 仅在拿到 Hindsight recall、`process-handoff.md/json`、`result.json` 与源码零 diff 证据后才会裁决是否采纳。
|
||||
- 2026-05-25:当前用户已手动覆盖 goal,后续批次统一收紧为“每批最多 2 个 worker”;本文件中早先 3/4-worker 记录仅作为历史执行事实保留,不再作为后续派发口径。
|
||||
- 2026-05-25:Batch BE 的 5-29 侧 Worker D `/mnt/Data1T/mnote-worktrees/0525-be-worker-d-5-29-layout-constant-readonly` 已由 Codex 主控独立复核后采纳为方向证据。
|
||||
- Codex 已读取 Hindsight recall、`process-handoff.md/json`、`result.json`,并核对该 worktree 源码零 diff;worktree 中仅新增 `final.md`、`process-handoff.*`、`result.json` 等审计产物,不视为源码修改。
|
||||
- 主控本地代码证据与只读结论一致:`content_text_left()` / `content_column_left()` / `content_column_width()` 与相关 `CONTENT_COLUMN_*` 常量目前确实在 [lib.rs](/mnt/Data1T/mnote/rust/spikes/leptos-tiptap-spike/src/lib.rs:69) 和 [block_menu_overlay.rs](/mnt/Data1T/mnote/rust/spikes/leptos-tiptap-spike/src/editor_runtime/block_menu_overlay.rs:19) 各保留一份,但这仍只是小规模重复,不是当前 `5-29` 的高收益下一刀。
|
||||
- 当前决定:不把 `content_text_left()` / 内容列布局常量单独拉成下一刀实现;若后续确实需要统一,应另起专门 design 或共享 helper 收口。当前更高收益方向仍是 selection bridge / host status 一带的边界审计与小切片,而不是继续追 slash fallback 或布局常量 DRY。
|
||||
- 2026-05-25:Batch BF 只派发 1 个只读 Reasonix worker 审计 `selection_payload / send_selection_state_to_target` 的下一刀边界,使用独立 worktree `/mnt/Data1T/mnote-worktrees/0525-bf-worker-a-5-29-selection-payload-readonly`,run id `reasonix-2026-05-25T01-11-58-275Z-2b2e8a66`,显式 `--no-memory-recall`。
|
||||
- 结果拒收:该 run 仅产出 `prompt.md` / `memory-recall.json` / `reasonix-transcript.jsonl`,没有 `result.json`、`process-handoff.md/json`、`final.md`;worktree 源码零 diff。
|
||||
- 过程异常:主控在等待 BF run 期间发现未批准 residual runner 自动启动了 Batch BE 的 4 个 worker(`0525-be-*`),已统一终止并拒收;在当前 2-worker 上限下,后续不再采纳任何未明确派发的 run。
|
||||
@@ -352,3 +355,8 @@ UI / 浏览器可见项必须有真实浏览器截图或结构化 smoke 证据
|
||||
- 边界:未迁 `handle_lane_left()`、`HANDLE_*` 常量、`slash_menu_anchor_style()`、drop indicator 壳层、block menu overlay 自身布局策略或 DOM 查询;本批只消除内容列布局 helper 的重复定义。
|
||||
- 已验证:`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 --target web --out-dir rust/spikes/leptos-tiptap-spike/generated/island --out-name mnote-leptos-tiptap-spike-island rust/spikes/leptos-tiptap-spike/target/wasm32-unknown-unknown/release/mnote_leptos_tiptap_spike.wasm`、临时当前源码服务 `MNOTE_WEB_BIND=127.0.0.1:3023 MNOTE_WEB_PUBLIC_BIND=127.0.0.1:3023 cargo run --manifest-path rust/Cargo.toml -p mnote-web`、`MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3023 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task489-block-menu-delete-undo-smoke.js`、`MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3023 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task488-local-attachment-link-delete-undo-smoke.js`、`MNOTE_WEB_SMOKE_BASE_URL=http://127.0.0.1:3023 NODE_PATH=/mnt/Data1T/mnote/node_modules node scripts/task479-local-folder-markdown-resource-lifecycle-smoke.js`。
|
||||
- 结果:`task489`、`task488`、`task479` 均通过,说明共享布局 helper 外置未破坏块菜单删除/撤销、附件删除/撤销和本地 Markdown 附件生命周期基线。
|
||||
- 2026-05-25:Codex 主控按 Batch BF 的最小下一刀建议,继续收口 `current_block_info_from_index()`。
|
||||
- 修改:`editor_runtime/dom_selection.rs` 新增 `CurrentBlockInfo` 与 `current_block_info_from_index(index)`,把 `current_block_index + runtime_block_id_from_index()` 的轻量 block info 组装迁入 selection runtime;`lib.rs` 删除本地 `CurrentBlockInfo` 结构与同名 helper,改为复用 runtime helper。
|
||||
- 边界:未迁 `selection_payload`、`dispatch_selection_event_to_target`、`send_selection_state_to_target`、`on_selection_change` 或任何 bridge dispatch;本批只收口 “index -> {index, block_id}” 的轻量数据 helper。
|
||||
- 影响点:`HostCommandKind::RequestCurrentBlockId` 分支继续在 `lib.rs` 壳层里取 hovered block index,但由 `dom_selection::current_block_info_from_index()` 返回 `block_id`;其余 selection event / runtime state 路径不变。
|
||||
- 已验证:待本批 fresh 验证后补充。
|
||||
|
||||
BIN
Binary file not shown.
@@ -43,8 +43,8 @@ use editor_runtime::command_sync::{
|
||||
use editor_runtime::content_layout::{content_column_left, content_text_left};
|
||||
use editor_runtime::dom_events::{event_target_matches_selector, target_element};
|
||||
use editor_runtime::dom_selection::{
|
||||
block_index_from_selection, runtime_block_id_from_index, selection_payload,
|
||||
selection_summary, SelectionPayload,
|
||||
block_index_from_selection, current_block_info_from_index, runtime_block_id_from_index,
|
||||
selection_payload, selection_summary, SelectionPayload,
|
||||
};
|
||||
use editor_runtime::editor_focus::{active_editor_stage, body_has_focus, schedule_editor_focus};
|
||||
use editor_runtime::overlays::{
|
||||
@@ -3224,12 +3224,6 @@ impl HostCommandKind {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
struct CurrentBlockInfo {
|
||||
index: Option<usize>,
|
||||
block_id: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -5188,18 +5182,6 @@ fn p0_extensions() -> Vec<TiptapExtension> {
|
||||
]
|
||||
}
|
||||
|
||||
fn current_block_info_from_index(index: Option<usize>) -> CurrentBlockInfo {
|
||||
index
|
||||
.map(|value| CurrentBlockInfo {
|
||||
index: Some(value),
|
||||
block_id: runtime_block_id_from_index(value),
|
||||
})
|
||||
.unwrap_or(CurrentBlockInfo {
|
||||
index: None,
|
||||
block_id: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn state_payload(
|
||||
document_id: Option<String>,
|
||||
workspace_id: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user