From a1d38b6bb8ceb9e6389a5558feea404916989d87 Mon Sep 17 00:00:00 2001 From: contributor Date: Wed, 22 Oct 2025 14:13:24 +0300 Subject: [PATCH 01/43] add 'Open note on server' menu item to NoteActions drop-down --- apps/client/src/components/app_context.ts | 1 + .../src/components/root_command_executor.ts | 7 +++++++ apps/client/src/services/open.ts | 17 +++++++++++++++++ .../client/src/translations/en/translation.json | 1 + apps/client/src/widgets/ribbon/NoteActions.tsx | 5 ++++- 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/apps/client/src/components/app_context.ts b/apps/client/src/components/app_context.ts index 23924edcb..c73fe5a42 100644 --- a/apps/client/src/components/app_context.ts +++ b/apps/client/src/components/app_context.ts @@ -329,6 +329,7 @@ export type CommandMappings = { exportAsPdf: CommandData; openNoteExternally: CommandData; openNoteCustom: CommandData; + openNoteOnServer: CommandData; renderActiveNote: CommandData; unhoist: CommandData; reloadFrontendApp: CommandData; diff --git a/apps/client/src/components/root_command_executor.ts b/apps/client/src/components/root_command_executor.ts index a2d62eddd..4a1c987f7 100644 --- a/apps/client/src/components/root_command_executor.ts +++ b/apps/client/src/components/root_command_executor.ts @@ -66,6 +66,13 @@ export default class RootCommandExecutor extends Component { } } + openNoteOnServerCommand() { + const noteId = appContext.tabManager.getActiveContextNoteId(); + if (noteId) { + openService.openNoteOnServer(noteId); + } + } + enterProtectedSessionCommand() { protectedSessionService.enterProtectedSession(); } diff --git a/apps/client/src/services/open.ts b/apps/client/src/services/open.ts index 783fcee48..1e5513c86 100644 --- a/apps/client/src/services/open.ts +++ b/apps/client/src/services/open.ts @@ -1,4 +1,5 @@ import utils from "./utils.js"; +import options from "./options.js"; import server from "./server.js"; type ExecFunction = (command: string, cb: (err: string, stdout: string, stderror: string) => void) => void; @@ -171,6 +172,21 @@ function getHost() { return `${url.protocol}//${url.hostname}:${url.port}`; } +async function openNoteOnServer(noteId: string) { + // Get the sync server host from options + const syncServerHost = options.get("syncServerHost"); + + if (!syncServerHost) { + console.error("No sync server host configured"); + return; + } + + const url = new URL(`#root/${noteId}`, syncServerHost).toString(); + + // Use window.open to ensure link opens in external browser in Electron + window.open(url, '_blank', 'noopener,noreferrer'); +} + async function openDirectory(directory: string) { try { if (utils.isElectron()) { @@ -198,5 +214,6 @@ export default { openAttachmentExternally, openNoteCustom, openAttachmentCustom, + openNoteOnServer, openDirectory }; diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 4d2be0ef9..ef9605d5e 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -682,6 +682,7 @@ "open_note_externally": "Open note externally", "open_note_externally_title": "File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.", "open_note_custom": "Open note custom", + "open_note_on_server": "Open note on server", "import_files": "Import files", "export_note": "Export note", "delete_note": "Delete note", diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index e35284ad4..5d31ae518 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -5,6 +5,7 @@ import { ParentComponent } from "../react/react_utils"; import { t } from "../../services/i18n" import { useContext } from "preact/hooks"; import { useIsNoteReadOnly } from "../react/hooks"; +import { useTriliumOption } from "../react/hooks"; import ActionButton from "../react/ActionButton" import appContext, { CommandNames } from "../../components/app_context"; import branches from "../../services/branches"; @@ -53,6 +54,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not const isMac = getIsMac(); const hasSource = ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "aiChat"].includes(note.type); const isSearchOrBook = ["search", "book"].includes(note.type); + const [ syncServerHost ] = useTriliumOption("syncServerHost"); const {isReadOnly, enableEditing} = useIsNoteReadOnly(note, noteContext); return ( @@ -68,7 +70,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not command={() => enableEditing()} /> } - + {canBeConvertedToAttachment && } {note.type === "render" && } @@ -90,6 +92,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not + From e811db3651d66eb481db22592bc8a2afde4595c6 Mon Sep 17 00:00:00 2001 From: contributor Date: Wed, 22 Oct 2025 14:45:31 +0300 Subject: [PATCH 02/43] only show "Open note on server" for electron app --- apps/client/src/widgets/ribbon/NoteActions.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index 5d31ae518..cbd3bf406 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -92,7 +92,9 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not - + {(syncServerHost && isElectron) && + + } From 2947967b79857cf9829ff6235a398e81a85feafa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 02:58:46 +0000 Subject: [PATCH 03/43] chore(deps): update pnpm to v10.21.0 --- apps/build-docs/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/build-docs/package.json b/apps/build-docs/package.json index 00196de82..01f8b0d48 100644 --- a/apps/build-docs/package.json +++ b/apps/build-docs/package.json @@ -9,7 +9,7 @@ "keywords": [], "author": "Elian Doran ", "license": "AGPL-3.0-only", - "packageManager": "pnpm@10.20.0", + "packageManager": "pnpm@10.21.0", "devDependencies": { "@redocly/cli": "2.11.0", "archiver": "7.0.1", diff --git a/package.json b/package.json index 04da94cce..373a7f752 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "url": "https://github.com/TriliumNext/Trilium/issues" }, "homepage": "https://triliumnotes.org", - "packageManager": "pnpm@10.20.0", + "packageManager": "pnpm@10.21.0", "pnpm": { "patchedDependencies": { "@ckeditor/ckeditor5-mention": "patches/@ckeditor__ckeditor5-mention.patch", From 4d1ebd011c2c8de7d406496c8bf0845f87c3dc71 Mon Sep 17 00:00:00 2001 From: contributor Date: Mon, 10 Nov 2025 09:54:53 +0200 Subject: [PATCH 04/43] ribbon Note Info in flex layout instead of table --- .../src/stylesheets/theme-next/ribbon.css | 3 +- .../client/src/widgets/ribbon/NoteInfoTab.tsx | 102 +++++++++--------- apps/client/src/widgets/ribbon/style.css | 17 +-- 3 files changed, 63 insertions(+), 59 deletions(-) diff --git a/apps/client/src/stylesheets/theme-next/ribbon.css b/apps/client/src/stylesheets/theme-next/ribbon.css index dc1465d17..3718602cf 100644 --- a/apps/client/src/stylesheets/theme-next/ribbon.css +++ b/apps/client/src/stylesheets/theme-next/ribbon.css @@ -42,7 +42,7 @@ div.promoted-attributes-container { */ /* The property label */ -.note-info-widget-table th, +.note-info-item > span:first-child, .file-properties-widget .file-table th, .image-properties > div:first-child > span > strong { opacity: 0.65; @@ -50,7 +50,6 @@ div.promoted-attributes-container { vertical-align: top; } -.note-info-widget-table td, .file-properties-widget .file-table td { vertical-align: top; } diff --git a/apps/client/src/widgets/ribbon/NoteInfoTab.tsx b/apps/client/src/widgets/ribbon/NoteInfoTab.tsx index 2e670d51d..8e2cfba0c 100644 --- a/apps/client/src/widgets/ribbon/NoteInfoTab.tsx +++ b/apps/client/src/widgets/ribbon/NoteInfoTab.tsx @@ -36,57 +36,59 @@ export default function NoteInfoTab({ note }: TabContext) { return (
{note && ( - - - - - - - - - - + <> +
+ {t("note_info_widget.note_id")}: + {note.noteId} +
+
+ {t("note_info_widget.created")}: + {formatDateTime(metadata?.dateCreated)} +
+
+ {t("note_info_widget.modified")}: + {formatDateTime(metadata?.dateModified)} +
+
+ {t("note_info_widget.type")}: + + {note.type}{' '} + {note.mime && ({note.mime})} + +
+
+ {t("note_info_widget.note_size")}: + + {!isLoading && !noteSizeResponse && !subtreeSizeResponse && ( +
- - - - - - - -
{t("note_info_widget.note_id")}:{note.noteId}{t("note_info_widget.created")}:{formatDateTime(metadata?.dateCreated)}{t("note_info_widget.modified")}:{formatDateTime(metadata?.dateModified)}
{t("note_info_widget.type")}: - {note.type}{' '} - { note.mime && ({note.mime}) } - {t("note_info_widget.note_size")}: - {!isLoading && !noteSizeResponse && !subtreeSizeResponse && ( -
+ + {formatSize(noteSizeResponse?.noteSize)} + {" "} + {subtreeSizeResponse && subtreeSizeResponse.subTreeNoteCount > 1 && + {t("note_info_widget.subtree_size", { size: formatSize(subtreeSizeResponse.subTreeSize), count: subtreeSizeResponse.subTreeNoteCount })} + } + {isLoading && } + + +
+ )} ) diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.css index 16437d618..5e7b98d3a 100644 --- a/apps/client/src/widgets/ribbon/style.css +++ b/apps/client/src/widgets/ribbon/style.css @@ -160,17 +160,20 @@ /* #region Note info */ .note-info-widget { padding: 12px; + display: flex; + flex-wrap: wrap; + align-items: baseline; } -.note-info-widget-table { - max-width: 100%; - display: block; - overflow-x: auto; - white-space: nowrap; +.note-info-item { + display: flex; + align-items: baseline; + padding-inline-end: 15px; + padding-block: 5px; } -.note-info-widget-table td, .note-info-widget-table th { - padding: 5px; +.note-info-item > span:first-child { + padding-inline-end: 5px; } .note-info-mime { From a1c959aabd7a9168ea067d2f9c87cbe83547dd94 Mon Sep 17 00:00:00 2001 From: contributor Date: Mon, 10 Nov 2025 10:56:05 +0200 Subject: [PATCH 05/43] use class instead of inline style for note info calculate button --- apps/client/src/widgets/ribbon/NoteInfoTab.tsx | 1 - apps/client/src/widgets/ribbon/style.css | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/ribbon/NoteInfoTab.tsx b/apps/client/src/widgets/ribbon/NoteInfoTab.tsx index 8e2cfba0c..2fb9daa80 100644 --- a/apps/client/src/widgets/ribbon/NoteInfoTab.tsx +++ b/apps/client/src/widgets/ribbon/NoteInfoTab.tsx @@ -62,7 +62,6 @@ export default function NoteInfoTab({ note }: TabContext) { {!isLoading && !noteSizeResponse && !subtreeSizeResponse && (