From dccdb5ceb7fd01a419b292a15a507bbb3be68c98 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 10 Jul 2025 17:54:27 +0300 Subject: [PATCH] feat(popup_editor): integrate with calendar for existing notes --- apps/client/src/services/link.ts | 12 +++++++++--- .../client/src/widgets/view_widgets/calendar_view.ts | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/client/src/services/link.ts b/apps/client/src/services/link.ts index a16f0bccf..3e357ee77 100644 --- a/apps/client/src/services/link.ts +++ b/apps/client/src/services/link.ts @@ -231,6 +231,7 @@ export function parseNavigationStateFromUrl(url: string | undefined) { let ntxId: string | null = null; let hoistedNoteId: string | null = null; let searchString: string | null = null; + let openInPopup = false; if (paramString) { for (const pair of paramString.split("&")) { @@ -246,6 +247,8 @@ export function parseNavigationStateFromUrl(url: string | undefined) { searchString = value; // supports triggering search from URL, e.g. #?searchString=blabla } else if (["viewMode", "attachmentId"].includes(name)) { (viewScope as any)[name] = value; + } else if (name === "popup") { + openInPopup = true; } else { console.warn(`Unrecognized hash parameter '${name}'.`); } @@ -266,7 +269,8 @@ export function parseNavigationStateFromUrl(url: string | undefined) { ntxId, hoistedNoteId, viewScope, - searchString + searchString, + openInPopup }; } @@ -299,7 +303,7 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent } } - const { notePath, viewScope } = parseNavigationStateFromUrl(hrefLink); + const { notePath, viewScope, openInPopup } = parseNavigationStateFromUrl(hrefLink); const ctrlKey = evt && utils.isCtrlKey(evt); const shiftKey = evt?.shiftKey; @@ -311,7 +315,9 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey; if (notePath) { - if (openInNewWindow) { + if (openInPopup) { + appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath }); + } else if (openInNewWindow) { appContext.triggerCommand("openInWindow", { notePath, viewScope }); } else if (openInNewTab) { appContext.tabManager.openTabWithNoteWithHoisting(notePath, { diff --git a/apps/client/src/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts index 4d6a32913..9cb074715 100644 --- a/apps/client/src/widgets/view_widgets/calendar_view.ts +++ b/apps/client/src/widgets/view_widgets/calendar_view.ts @@ -533,7 +533,7 @@ export default class CalendarView extends ViewMode<{}> { const eventData: EventInput = { title: title, start: startDate, - url: `#${note.noteId}`, + url: `#${note.noteId}?popup`, noteId: note.noteId, color: color ?? undefined, iconClass: note.getLabelValue("iconClass"),