fix: 🐛 绑定动作无法打开代码面板

This commit is contained in:
林熠 2020-05-07 17:24:33 +08:00
parent a891e3be01
commit 160d6f73e5
2 changed files with 14 additions and 16 deletions

View File

@ -126,7 +126,11 @@ export default class Panel implements IWidget {
}
active(item?: Panel | string | null) {
this.container?.active(item);
if (item) {
this.container?.active(item);
} else {
this.setActive(true);
}
}
getName() {

View File

@ -69,17 +69,7 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
newConfig.type = 'PanelDock';
newConfig.area = 'left';
newConfig.props.description = description || title;
const {
contents,
hideTitleBar,
tip,
width,
maxWidth,
height,
maxHeight,
menu,
isAction
} = config;
const { contents, hideTitleBar, tip, width, maxWidth, height, maxHeight, menu, isAction } = config;
if (menu) {
newConfig.props.title = menu;
}
@ -97,14 +87,14 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
if (contents && Array.isArray(contents)) {
newConfig.content = contents.map(({ title, content, tip }) => {
return {
type: "Panel",
type: 'Panel',
name: title,
content,
props: {
title,
help: tip,
}
}
},
};
});
}
}
@ -163,7 +153,11 @@ const dockPane = Object.assign(skeleton.leftArea, {
return;
}
const name = item.name || item;
skeleton.getPanel(name)?.active();
const pane = skeleton.getPanel(name);
if (!pane) {
console.warn(`Could not find pane with name ${name}`);
}
pane?.active();
},
/**