diff --git a/src/dailyNoteViewIndex.ts b/src/dailyNoteViewIndex.ts index 96c490e..961cf03 100644 --- a/src/dailyNoteViewIndex.ts +++ b/src/dailyNoteViewIndex.ts @@ -115,6 +115,13 @@ export default class DailyNoteViewPlugin extends Plugin { async openDailyNoteEditor() { const workspace = this.app.workspace; + + const existingLeaves = workspace.getLeavesOfType(DAILY_NOTE_VIEW_TYPE); + if (existingLeaves.length > 0) { + workspace.revealLeaf(existingLeaves[0]); + return; + } + const leaf = workspace.getLeaf(true); await leaf.setViewState({ type: DAILY_NOTE_VIEW_TYPE }); workspace.revealLeaf(leaf);