Skip to content

Commit

Permalink
Add command to insert link to today with label
Browse files Browse the repository at this point in the history
  • Loading branch information
ethancedwards8 committed Aug 13, 2023
1 parent 8cdba7f commit 6f0050c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,24 @@ joplin.plugins.register({
}
});

await joplin.commands.register({
name: "linkTodayNoteWithLabel",
label: "Insert link to Today's Note with label 'Today'",
execute: async () => {
const d = new Date();
const ds = new Date(`${d.getFullYear()}-${padding(d.getMonth() + 1)}-${padding(d.getDate())}`);
const note = await createNoteByDate(ds);
await joplin.commands.execute("insertText", `[Today](:/${note.id})`);
await joplin.commands.execute('editor.focus');
}
});


await joplin.views.menus.create('journal-menu', 'Journal', [
{ label: "Open Today's Note", commandName: "openTodayNote", accelerator: "CmdOrCtrl+Alt+D" },
{ label: "Open Another day's Note", commandName: "openOtherdayNote", accelerator: "CmdOrCtrl+Alt+O" },
{ label: "Insert link to Today's Note", commandName: "linkTodayNote", accelerator: "CmdOrCtrl+Alt+L" },
{ label: "Insert link to Today's Note with Label", commandName: "linkTodayNoteWithLabel", accelerator: "CmdOrCtrl+Alt+I" },
{ label: "Insert link to Another day's Note", commandName: "linkOtherDayNote", accelerator: "CmdOrCtrl+Alt+T" },
]);

Expand Down

0 comments on commit 6f0050c

Please sign in to comment.