Skip to content

Commit

Permalink
Merge pull request #95 from liamcain/fix-open-weekly-note
Browse files Browse the repository at this point in the history
Fix 'open weekly note' command
  • Loading branch information
liamcain authored Dec 29, 2020
2 parents 06ee2fd + 66f1127 commit 1d0bd59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 1d0bd59

Please sign in to comment.