From 66f1127ac5a698395367ed58d99ab4b6209a7620 Mon Sep 17 00:00:00 2001 From: Liam Cain Date: Tue, 29 Dec 2020 10:19:57 -0500 Subject: [PATCH] Fix 'open weekly note' command --- manifest.json | 2 +- package.json | 2 +- src/main.ts | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 1ce9697..aaf1199 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "id": "calendar", "name": "Calendar", "description": "Calendar view of your daily notes", - "version": "1.4.10", + "version": "1.4.11", "author": "Liam Cain", "authorUrl": "https://github.com/liamcain/", "isDesktopOnly": false, diff --git a/package.json b/package.json index 00be402..76c0782 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calendar", - "version": "1.4.10", + "version": "1.4.11", "description": "Calendar view of your daily notes", "author": "liamcain", "main": "main.js", diff --git a/src/main.ts b/src/main.ts index a52a49e..71ea58b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import { App, Plugin, WorkspaceLeaf } from "obsidian"; import { configureMomentLocale } from "src/localization"; import { VIEW_TYPE_CALENDAR } from "./constants"; +import { getWeeklyNote } from "./io/weeklyNotes"; import { CalendarSettingsTab, SettingsInstance, @@ -60,8 +61,11 @@ export default class CalendarPlugin extends Plugin { this.addCommand({ id: "open-weekly-note", name: "Open Weekly Note", - callback: () => - this.view.openOrCreateWeeklyNote(window.moment(), null, false), + callback: () => { + const date = window.moment(); + const existingFile = getWeeklyNote(date, this.options); + this.view.openOrCreateWeeklyNote(date, existingFile, false); + }, }); this.addCommand({