diff --git a/main.ts b/main.ts index e0cbc52..97b2064 100644 --- a/main.ts +++ b/main.ts @@ -54,15 +54,18 @@ export default class Intelligence extends Plugin { } async activateView() { - this.app.workspace.detachLeavesOfType(INTELLIGENCE_VIEW_TYPE); - + + if (this.app.workspace.getLeavesOfType(INTELLIGENCE_VIEW_TYPE).length > 0) { + this.revealView(); + return; + } await this.app.workspace.getRightLeaf(false).setViewState({ type: INTELLIGENCE_VIEW_TYPE, active: true, }); - this.revealView(); } + async revealView() { this.app.workspace.revealLeaf( this.app.workspace.getLeavesOfType(INTELLIGENCE_VIEW_TYPE)[0],