fix: fallback focusNode to root if empty

This commit is contained in:
LeoYuan 袁力皓 2022-06-10 14:42:24 +08:00 committed by 林熠
parent f61e2a2b8a
commit a9a118fe6e
2 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ export class DocumentModel {
this.rootNode?.getExtraProp('fileName', true)?.setValue(fileName); this.rootNode?.getExtraProp('fileName', true)?.setValue(fileName);
} }
@computed get focusNode() { get focusNode() {
if (this._drillDownNode) { if (this._drillDownNode) {
return this._drillDownNode; return this._drillDownNode;
} }

View File

@ -89,7 +89,7 @@ export default class DocumentModel {
} }
get focusNode(): Node { get focusNode(): Node {
return this._focusNode; return this._focusNode || this.root;
} }
set focusNode(node: Node) { set focusNode(node: Node) {