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

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