From a9a118fe6e79080245c6eea42ed26772b7c784ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LeoYuan=20=E8=A2=81=E5=8A=9B=E7=9A=93?= Date: Fri, 10 Jun 2022 14:42:24 +0800 Subject: [PATCH] fix: fallback focusNode to root if empty --- packages/designer/src/document/document-model.ts | 2 +- packages/shell/src/document-model.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/designer/src/document/document-model.ts b/packages/designer/src/document/document-model.ts index 22fe8d3c6..e92b5aae7 100644 --- a/packages/designer/src/document/document-model.ts +++ b/packages/designer/src/document/document-model.ts @@ -93,7 +93,7 @@ export class DocumentModel { this.rootNode?.getExtraProp('fileName', true)?.setValue(fileName); } - @computed get focusNode() { + get focusNode() { if (this._drillDownNode) { return this._drillDownNode; } diff --git a/packages/shell/src/document-model.ts b/packages/shell/src/document-model.ts index 3177f3b69..558a31c5f 100644 --- a/packages/shell/src/document-model.ts +++ b/packages/shell/src/document-model.ts @@ -89,7 +89,7 @@ export default class DocumentModel { } get focusNode(): Node { - return this._focusNode; + return this._focusNode || this.root; } set focusNode(node: Node) {