Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: add "Edit title" to the card context menu

Adorian Doran48550e4f5d99
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 28ce6c1b82..98ca1fec6e 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -3372,6 +3372,7 @@
"unarchive-note": "Unarchive note",
"status-header": "Status",
"duplicate-item": "Duplicate",
+ "edit-title": "Edit title",
"insert-above": "Insert above",
"insert-below": "Insert below",
"delete-column": "Delete column...",
diff --git a/apps/client/src/widgets/collections/board/context_menu.spec.ts b/apps/client/src/widgets/collections/board/context_menu.spec.ts
index e2147c72c4..4b08802dbc 100644
--- a/apps/client/src/widgets/collections/board/context_menu.spec.ts
+++ b/apps/client/src/widgets/collections/board/context_menu.spec.ts
@@ -377,6 +377,25 @@ describe("Board item context menu", () => {
afterEach(() => vi.restoreAllMocks());
+ /** The same editor F2 opens, for a reader who came to the card with the mouse. */
+ it("opens the card's title editor", () => {
+ const api = {
+ columns: [],
+ isColumnArchived: () => false,
+ getColumnIcon: () => DEFAULT_COLUMN_ICON,
+ getColumnColorClass: () => "",
+ startEditing: vi.fn()
+ } as unknown as BoardApi;
+
+ const entry = openItemMenu(api).find(item =>
+ item && "uiIcon" in item && item.uiIcon === "bx bx-rename");
+ if (!entry || !("handler" in entry)) throw new Error("expected an edit-title entry");
+ expect("shortcut" in entry && entry.shortcut).toBe("F2");
+
+ entry.handler?.(entry, {} as never);
+ expect(api.startEditing).toHaveBeenCalledWith("branchId");
+ });
+
it("inserts a card on either side of the one it was opened on", () => {
const api = {
columns: [],
diff --git a/apps/client/src/widgets/collections/board/context_menu.ts b/apps/client/src/widgets/collections/board/context_menu.ts
index 94dbaf02e7..5dec082754 100644
--- a/apps/client/src/widgets/collections/board/context_menu.ts
+++ b/apps/client/src/widgets/collections/board/context_menu.ts
@@ -315,6 +315,12 @@ export function openNoteContextMenu(
y: event.pageY,
items: [
...link_context_menu.getItems(event),
+ {
+ title: t("board_view.edit-title"),
+ uiIcon: "bx bx-rename",
+ shortcut: "F2",
+ handler: () => api.startEditing(branchId)
+ },
{ kind: "separator" },
{
title: t("board_view.insert-above"),