From f3e4365530c2215f55d00b103ffcaad512080466 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Fri, 13 Nov 2026 23:50:07 +0800 Subject: [PATCH] Bridge standard commands to native React tasks Co-Authored-By: Claude Code --- web/docs/current/desktop-parity-continuation.md | 6 ++++++ web/src/project-shell.tsx | 12 ++++++++++++ web/src/shell/command-palette.tsx | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/web/docs/current/desktop-parity-continuation.md b/web/docs/current/desktop-parity-continuation.md index b49bf467..f08e5188 100644 --- a/web/docs/current/desktop-parity-continuation.md +++ b/web/docs/current/desktop-parity-continuation.md @@ -85,6 +85,12 @@ 其余打开 TaskFrame);最多显示 400 条; - 实测搜索 `Part_Box` 返回 4 条,0 pageError;截图 `command-palette.png`。 - 该面板给 1492 条命令提供统一 UI 入口,后续按执行成功率分类补齐。 +- **标准命令原生桥**:命令面板/快捷键命中以下命令时不再打开 TaskFrame: + - `Std_DlgPreferences` → Preferences 对话框; + - `Std_DlgCustomize` → 快捷键编辑器; + - `Std_SetAppearance` / `Std_SetMaterial` → 原生外观/材料任务; + - `Std_Measure` / `Std_MassProperties` → 原生测量/质量属性任务。 + 实测 `Std_MassProperties` 状态栏返回 “opened native measure task”,0 pageError。 - 说明:外部工作台仍是 iframe,未共享项目文档;Python 控制台尚未接入; 原生 Shortcut 参数同步待 P3。 - 非 Part 菜单命令改为打开 **React TaskFrame 模态**(`web/src/shell/task-frame.tsx`), diff --git a/web/src/project-shell.tsx b/web/src/project-shell.tsx index ae1ad1c7..b3439bc4 100644 --- a/web/src/project-shell.tsx +++ b/web/src/project-shell.tsx @@ -1738,6 +1738,18 @@ function App() { || !partSnapshots[active]?.objects?.some(object => object.name === compoundSelection[0] && object.topology?.Face && object.type !== "App::Link")); const executeManifestCommand = async (command: string) => { if (!active) return; + if (command === "Std_DlgPreferences") { setPreferencesOpen(true); return; } + if (command === "Std_DlgCustomize") { setShortcutsOpen(true); return; } + if (command === "Std_SetAppearance") { setWorkspaceTask("appearance"); setStatus("Std_SetAppearance: opened native appearance task"); return; } + if (command === "Std_SetMaterial") { setWorkspaceTask("material-assignment"); setStatus("Std_SetMaterial: opened native material task"); return; } + if (command === "Std_Measure" || command === "Std_MassProperties") { + const names = compoundSelection.length ? compoundSelection + : selectedObject?.properties.NativeName ? [String(selectedObject.properties.NativeName)] : []; + setMeasureSelection(names.map(object => ({ documentId: nativeName(active), object }))); + setWorkspaceTask(command === "Std_Measure" ? "measure-distance" : "measure-mass-properties"); + setStatus(`${command}: opened native measure task`); + return; + } const sceneCommand = /^(Std_View|Std_Toggle|Std_DrawStyle|Std_AlignToSelection|Std_BoxSelection|Part_BoxSelection)/.test(command); if (!sceneCommand) { setParityTask({ module: workbench, command }); diff --git a/web/src/shell/command-palette.tsx b/web/src/shell/command-palette.tsx index 1c2bcda2..5f8a8f4d 100644 --- a/web/src/shell/command-palette.tsx +++ b/web/src/shell/command-palette.tsx @@ -20,7 +20,7 @@ export function CommandPalette({ workbench, onCommand, onClose }: { const rows = useMemo(() => { const query = search.trim().toLowerCase(); return records.filter(record => scope === "all" || record.module === workbench - || record.module === "Web" || record.module === "Std") + || ["Web", "Std", "Show", "Measure", "Material"].includes(record.module)) .filter(record => !query || record.command.toLowerCase().includes(query) || (manifest && commandLabel(manifest, record.command).toLowerCase().includes(query))) .slice(0, 400);