Bridge standard commands to native React tasks

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-11-13 23:50:07 +08:00
parent fa420201e6
commit f3e4365530
3 changed files with 19 additions and 1 deletions

View File

@@ -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`),

View File

@@ -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 });

View File

@@ -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);