fix: 修复SubEditor左右面板为空问题

Change-Id: I1b17ebcc52434f421cc0e7525a3bac2a5cc27abf
This commit is contained in:
wibetter 2022-06-22 15:08:18 +08:00
parent d5372523bd
commit 4dce9abb60
2 changed files with 21 additions and 1 deletions

View File

@ -60,11 +60,25 @@ export class SubEditor extends React.Component<SubEditorProps> {
handleBuildPanels(event: PluginEvent<BuildPanelEventContext>) {
const store = this.props.store;
const slot = store.subEditorContext?.slot;
if (!slot) {
return;
}
const slotPath = store.subEditorSlotPath;
// const slotPath = store.subEditorSlotPath;
const context = event.context;
// 成员节点固定时,不展示组件面板
if (!!context.info.memberImmutable) {
const panels = context.data.concat();
context.data.splice(0, context.data.length);
const renderersPanel = panels.filter(r => r.key !== 'renderers');
renderersPanel && context.data.push(...renderersPanel);
// 默认选中大纲
context.changeLeftPanelKey = 'outline';
}
/*
// 备注: 当前逻辑有点问题context.schemaPath 基本上都不会含 slotPath先注释掉。
if (!~context.schemaPath.indexOf(slotPath)) {
const panels = context.data.concat();
context.data.splice(0, context.data.length);
@ -75,6 +89,7 @@ export class SubEditor extends React.Component<SubEditorProps> {
renderersPanel && context.data.push(renderersPanel);
}
}
*/
}
buildSchema() {

View File

@ -421,6 +421,11 @@ export class EditorManager {
triggerEvent && this.trigger('build-panels', context);
panels = context.data || panels;
if (context.changeLeftPanelKey) {
// 改变左侧激活面板
this.store.changeLeftPanelKey(context.changeLeftPanelKey);
}
}
return panels;