Skip to content

Build your personal knowledge base with Trilium Notes

client/image compression tool: integrate into the tree context menu

Adorian Doran6b9d208d18ab
diff --git a/apps/client/src/menus/tree_context_menu.ts b/apps/client/src/menus/tree_context_menu.ts
index f188dea234..47db7ac02d 100644
--- a/apps/client/src/menus/tree_context_menu.ts
+++ b/apps/client/src/menus/tree_context_menu.ts
@@ -18,6 +18,7 @@ import toastService from "../services/toast.js";
import treeService from "../services/tree.js";
import utils from "../services/utils.js";
import type NoteTreeWidget from "../widgets/note_tree.js";
+import { showImageCompressionDialog } from "../widgets/type_widgets/options/content_manager/space_usage/image_compression_dialog.jsx";
import contextMenu, { type MenuCommandItem, type MenuItem } from "./context_menu.js";
import NoteColorPicker from "./custom-items/NoteColorPicker.jsx";
@@ -181,6 +182,14 @@ export async function buildTreeContextMenuItems(ctx: TreeContextMenuContext): Pr
enabled: true,
items: [
{ title: t("tree-context-menu.apply-bulk-actions"), command: "openBulkActionsDialog", uiIcon: "bx bx-list-plus", enabled: true },
+ {
+ // One note at a time: the dialog is configured against what that note holds and
+ // reports on what it changed there, neither of which a multi-selection has.
+ title: t("compress-images"),
+ uiIcon: "bx bx-collapse-alt",
+ enabled: noSelectedNotes && notOptionsOrHelp,
+ handler: () => void showImageCompressionDialog({ type: "note", noteId: note.noteId })
+ },
{ kind: "separator" },