From 160d6f73e54bf552608e94063666a3832c65ed3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=86=A0?= Date: Thu, 7 May 2020 17:24:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-skeleton/src/widget/panel.ts | 6 ++++- packages/vision-preset/src/panes.ts | 24 ++++++++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/editor-skeleton/src/widget/panel.ts b/packages/editor-skeleton/src/widget/panel.ts index 901545fe3..ff7273683 100644 --- a/packages/editor-skeleton/src/widget/panel.ts +++ b/packages/editor-skeleton/src/widget/panel.ts @@ -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() { diff --git a/packages/vision-preset/src/panes.ts b/packages/vision-preset/src/panes.ts index 4630e2f1a..e9d509525 100644 --- a/packages/vision-preset/src/panes.ts +++ b/packages/vision-preset/src/panes.ts @@ -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(); }, /**