mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
feat(popup_editor): integrate with calendar for existing notes
This commit is contained in:
parent
f961698e44
commit
dccdb5ceb7
@ -231,6 +231,7 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
|
|||||||
let ntxId: string | null = null;
|
let ntxId: string | null = null;
|
||||||
let hoistedNoteId: string | null = null;
|
let hoistedNoteId: string | null = null;
|
||||||
let searchString: string | null = null;
|
let searchString: string | null = null;
|
||||||
|
let openInPopup = false;
|
||||||
|
|
||||||
if (paramString) {
|
if (paramString) {
|
||||||
for (const pair of paramString.split("&")) {
|
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
|
searchString = value; // supports triggering search from URL, e.g. #?searchString=blabla
|
||||||
} else if (["viewMode", "attachmentId"].includes(name)) {
|
} else if (["viewMode", "attachmentId"].includes(name)) {
|
||||||
(viewScope as any)[name] = value;
|
(viewScope as any)[name] = value;
|
||||||
|
} else if (name === "popup") {
|
||||||
|
openInPopup = true;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Unrecognized hash parameter '${name}'.`);
|
console.warn(`Unrecognized hash parameter '${name}'.`);
|
||||||
}
|
}
|
||||||
@ -266,7 +269,8 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
|
|||||||
ntxId,
|
ntxId,
|
||||||
hoistedNoteId,
|
hoistedNoteId,
|
||||||
viewScope,
|
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 ctrlKey = evt && utils.isCtrlKey(evt);
|
||||||
const shiftKey = evt?.shiftKey;
|
const shiftKey = evt?.shiftKey;
|
||||||
@ -311,7 +315,9 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent
|
|||||||
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
|
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
if (openInNewWindow) {
|
if (openInPopup) {
|
||||||
|
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
|
||||||
|
} else if (openInNewWindow) {
|
||||||
appContext.triggerCommand("openInWindow", { notePath, viewScope });
|
appContext.triggerCommand("openInWindow", { notePath, viewScope });
|
||||||
} else if (openInNewTab) {
|
} else if (openInNewTab) {
|
||||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
|
||||||
|
@ -533,7 +533,7 @@ export default class CalendarView extends ViewMode<{}> {
|
|||||||
const eventData: EventInput = {
|
const eventData: EventInput = {
|
||||||
title: title,
|
title: title,
|
||||||
start: startDate,
|
start: startDate,
|
||||||
url: `#${note.noteId}`,
|
url: `#${note.noteId}?popup`,
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
color: color ?? undefined,
|
color: color ?? undefined,
|
||||||
iconClass: note.getLabelValue("iconClass"),
|
iconClass: note.getLabelValue("iconClass"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user