You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
【Studio】Code tab does not show code export (default-plugin viewer always renders preview, not code) #1079
Bug
现象(What happens)
期望结果(What should happen)
技术细节 / 根因分析
default-plugin.tsx只注册了一个 metadataViewer(json-inspector),声明支持modes: ['preview', 'code'],但其组件 (DefaultViewerComponent) 并没有根据mode切换。preview还是code,都只渲染<MetadataInspector>,导致 toolbar 切换模式无法生效。CodeExporter已有(支持切 TypeScript/JSON/copy),但没有路由到code模式。推荐修复方案:
json-inspector (preview)和code-inspector (code),分别注册到MetadataInspector和CodeExporter。PluginHost下切换 code 模式时,走code-inspector,渲染<CodeExporter type=... definition=... />,类型根据 metadataType 匹配(如 object/view/flow/agent/app)。相关源码位置(关键文件)
apps/studio/src/plugins/built-in/default-plugin.tsxapps/studio/src/components/CodeExporter.tsxapps/studio/src/plugins/plugin-host.tsx