2025-05-17 10:03:37 +03:00
|
|
|
import "normalize.css";
|
2025-05-17 10:13:03 +03:00
|
|
|
import "@triliumnext/ckeditor5/content.css";
|
2025-06-09 14:13:35 +03:00
|
|
|
import "@triliumnext/share-theme/styles/index.css";
|
2025-06-09 14:39:56 +03:00
|
|
|
import "@triliumnext/share-theme/scripts/index.js";
|
2025-02-21 22:07:23 +01:00
|
|
|
|
2022-01-01 13:23:09 +01:00
|
|
|
/**
|
|
|
|
* Fetch note with given ID from backend
|
|
|
|
*
|
2023-06-23 00:26:47 +08:00
|
|
|
* @param noteId of the given note to be fetched. If false, fetches current note.
|
2022-01-01 13:23:09 +01:00
|
|
|
*/
|
2025-01-26 20:54:30 +01:00
|
|
|
async function fetchNote(noteId: string | null = null) {
|
2022-01-01 13:23:09 +01:00
|
|
|
if (!noteId) {
|
2022-01-01 22:32:38 +01:00
|
|
|
noteId = document.body.getAttribute("data-note-id");
|
2022-01-01 13:23:09 +01:00
|
|
|
}
|
|
|
|
|
2022-01-01 22:32:38 +01:00
|
|
|
const resp = await fetch(`api/notes/${noteId}`);
|
2022-01-01 13:23:09 +01:00
|
|
|
|
|
|
|
return await resp.json();
|
|
|
|
}
|
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
document.addEventListener(
|
|
|
|
"DOMContentLoaded",
|
|
|
|
() => {
|
|
|
|
const toggleMenuButton = document.getElementById("toggleMenuButton");
|
|
|
|
const layout = document.getElementById("layout");
|
2022-01-01 13:23:09 +01:00
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
if (toggleMenuButton && layout) {
|
|
|
|
toggleMenuButton.addEventListener("click", () => layout.classList.toggle("showMenu"));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
2025-01-26 21:23:08 +01:00
|
|
|
|
|
|
|
// workaround to prevent webpack from removing "fetchNote" as dead code:
|
|
|
|
// add fetchNote as property to the window object
|
|
|
|
Object.defineProperty(window, "fetchNote", {
|
|
|
|
value: fetchNote
|
2025-03-02 20:47:57 +01:00
|
|
|
});
|