Embed external workbench workspaces in project shell stage

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-11-13 23:11:34 +08:00
parent 7a3989eb99
commit 1454e259be
4 changed files with 24 additions and 2 deletions

View File

@@ -73,7 +73,13 @@
BoxSelection 等不再打开 TaskFrame,而是走 `DesktopCommandDispatcher`
的 scene/dock 命令(20 秒超时)。快捷键实测 `Std_ViewFitAll` 已进入内核,
返回 “The current document has no mounted 3D view”(空文档前置未满足,符合预期)。
- 说明:Python 控制台尚未接入;原生 Shortcut 参数同步待 P3。
- **外部工作台已嵌入主舞台**:`shell/workbench-frame.tsx`。
- Part/Sketcher/PartDesign/Spreadsheet/Surface/Assembly/Draft 继续用原生工作区;
- BIM/CAM/Fem/Mesh/TechDraw 等切换到对应 `/workbench.html?module=` 工作台,
原 Part 视口隐藏;BIM 实测 iframe 挂载、视口 display:none、0 pageError;
截图 `BIM-workbench-frame.png`。
- 说明:外部工作台仍是 iframe,未共享项目文档;Python 控制台尚未接入;
原生 Shortcut 参数同步待 P3。
- 非 Part 菜单命令改为打开 **React TaskFrame 模态**(`web/src/shell/task-frame.tsx`),
iframe 复用 `/workbench.html?module=<id>&command=<id>` 的现有任务面板;
BIM_TogglePanels 实测弹出 "Bottom panels" 任务并可点按钮,0 pageError;

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

@@ -90,6 +90,7 @@ import { PreferencesDialog, loadWebPreferences } from "./shell/preferences-dialo
import { formatLength, formatVolume, unitInfo } from "./shell/units.js";
import { ShortcutEditor, ShortcutManager } from "./shell/shortcut-manager.js";
import { BottomDock } from "./shell/bottom-dock.js";
import { WorkbenchFrame, isExternalWorkbench } from "./shell/workbench-frame.js";
import { DesktopCommandDispatcher } from "./desktop-command-dispatcher.js";
import type { WorkbenchCommandRecord } from "./workbench-command-facade.js";
import { DocumentTree, type DocumentTreeNode } from "./document-tree.js";
@@ -2198,7 +2199,8 @@ function App() {
{openScadSnapshots[active] && <OpenScadDesktopView document={openScadSnapshots[active]}
selected={selectedObjects[active] ? [selectedObjects[active]!.replace(/^native:/, "")] : []}
onSelect={name => selectPrimaryObject(`native:${name}`)} />}
<div ref={viewportRef} style={openScadDocuments.current.has(active) || testDocuments.current.has(active) ? { display: "none" } : undefined} className="viewport" aria-label="Imported native 3D view" />
<div ref={viewportRef} style={openScadDocuments.current.has(active) || testDocuments.current.has(active) || isExternalWorkbench(workbench) ? { display: "none" } : undefined} className="viewport" aria-label="Imported native 3D view" />
{isExternalWorkbench(workbench) && <WorkbenchFrame workbench={workbench} />}
<div className="viewport-transform-bar" role="toolbar" aria-label="Object transform">
{([["translate", "移动"], ["rotate", "旋转"], ["off", "关闭"]] as const).map(([mode, label]) => (
<button key={mode} className="tool" title={`${label}控制器`} aria-label={`${label}控制器`} aria-pressed={transformMode === mode}

View File

@@ -0,0 +1,14 @@
import React from "react";
const LOCAL_WORKBENCHES = new Set(["Part", "Sketcher", "PartDesign", "Spreadsheet", "Surface", "Assembly", "Draft"]);
export const isExternalWorkbench = (workbench: string) => !LOCAL_WORKBENCHES.has(workbench);
export function WorkbenchFrame({ workbench }: { workbench: string }) {
return <div className="workbench-frame" aria-label={`${workbench} workbench workspace`}>
<style>{`
.workbench-frame{flex:1;min-height:0;display:flex;border-top:1px solid #2a3a45;background:#0f1419}
.workbench-frame iframe{flex:1;width:100%;border:0;background:#0f1419}
`}</style>
<iframe title={`${workbench} workbench`} src={`/workbench.html?module=${encodeURIComponent(workbench)}`} />
</div>;
}