mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 09:19:34 +05:30
feat(menu): add 'Today's Daily Note' under Tools
Same handler as the global Ctrl+Alt+D shortcut — opens (or creates) the local-date YYYY-MM-DD.md and sends a file-opened IPC to the renderer. Mirrors the Quick Note pattern in the same submenu (global shortcut + menu entry, both pointing at openOrCreate). Amit Haridas
This commit is contained in:
+24
@@ -1542,6 +1542,30 @@ function createMenu() {
|
|||||||
accelerator: 'CmdOrCtrl+Alt+Q',
|
accelerator: 'CmdOrCtrl+Alt+Q',
|
||||||
click: () => openQuickNoteWindow(),
|
click: () => openQuickNoteWindow(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Daily journal: opens (or creates) today's YYYY-MM-DD.md and
|
||||||
|
// loads it in the existing tab. Global Ctrl+Alt+D works even
|
||||||
|
// when the app is unfocused.
|
||||||
|
label: "Today's Daily Note",
|
||||||
|
accelerator: 'CmdOrCtrl+Alt+D',
|
||||||
|
click: () => {
|
||||||
|
try {
|
||||||
|
const result = DailyNotes.openOrCreate({
|
||||||
|
date: new Date(),
|
||||||
|
dir: dailyNotesDir(),
|
||||||
|
templateDir: dailyNotesTemplateDir(),
|
||||||
|
fs,
|
||||||
|
pathUtil: path,
|
||||||
|
now: new Date(),
|
||||||
|
});
|
||||||
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
|
mainWindow.webContents.send('file-opened', { filePath: result.path });
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('[daily-notes] menu open failed:', err && err.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Document Compare',
|
label: 'Document Compare',
|
||||||
click: () => mainWindow.webContents.send('show-document-compare'),
|
click: () => mainWindow.webContents.send('show-document-compare'),
|
||||||
|
|||||||
Reference in New Issue
Block a user