reveal view

This commit is contained in:
ransurf 2023-12-12 18:11:03 -08:00
parent fdacd20f38
commit 0363c0f167
1 changed files with 6 additions and 3 deletions

View File

@ -54,15 +54,18 @@ export default class Intelligence extends Plugin {
} }
async activateView() { 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({ await this.app.workspace.getRightLeaf(false).setViewState({
type: INTELLIGENCE_VIEW_TYPE, type: INTELLIGENCE_VIEW_TYPE,
active: true, active: true,
}); });
this.revealView(); this.revealView();
} }
async revealView() { async revealView() {
this.app.workspace.revealLeaf( this.app.workspace.revealLeaf(
this.app.workspace.getLeavesOfType(INTELLIGENCE_VIEW_TYPE)[0], this.app.workspace.getLeavesOfType(INTELLIGENCE_VIEW_TYPE)[0],