feat(popup_editor): integrate with calendar for existing notes

This commit is contained in:
Elian Doran 2025-07-10 17:54:27 +03:00
parent f961698e44
commit dccdb5ceb7
No known key found for this signature in database
2 changed files with 10 additions and 4 deletions

View File

@ -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, {

View File

@ -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"),