From b450a4faa0c6dcb593f3b36dfafbe715d55e7f8c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 15:39:13 +0300 Subject: [PATCH 1/6] fix(client): delete shortcut key not working --- apps/client/src/services/shortcuts.spec.ts | 8 +++++++- apps/client/src/services/shortcuts.ts | 14 +++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/client/src/services/shortcuts.spec.ts b/apps/client/src/services/shortcuts.spec.ts index 405c71359..d9c2547a9 100644 --- a/apps/client/src/services/shortcuts.spec.ts +++ b/apps/client/src/services/shortcuts.spec.ts @@ -148,13 +148,19 @@ describe("shortcuts", () => { expect(matchesShortcut(event, "a")).toBe(false); }); - it("should match function keys even with no modifiers", () => { + it("should match some keys even with no modifiers", () => { + // Bare function keys let event = createKeyboardEvent({ key: "F1", code: "F1" }); expect(matchesShortcut(event, "F1")).toBeTruthy(); expect(matchesShortcut(event, "f1")).toBeTruthy(); + // Function keys with shift event = createKeyboardEvent({ key: "F1", code: "F1", shiftKey: true }); expect(matchesShortcut(event, "Shift+F1")).toBeTruthy(); + + // Delete + event = createKeyboardEvent({ key: "Delete", code: "Delete" }); + expect(matchesShortcut(event, "Delete")).toBeTruthy(); }); it("should handle alternative modifier names", () => { diff --git a/apps/client/src/services/shortcuts.ts b/apps/client/src/services/shortcuts.ts index 92bb02d66..5e8cd52a5 100644 --- a/apps/client/src/services/shortcuts.ts +++ b/apps/client/src/services/shortcuts.ts @@ -36,10 +36,18 @@ const keyMap: { [key: string]: string[] } = { }; // Function keys +const functionKeyCodes: string[] = []; for (let i = 1; i <= 19; i++) { - keyMap[`f${i}`] = [`F${i}`]; + const keyCode = `F${i}`; + functionKeyCodes.push(keyCode); + keyMap[`f${i}`] = [ keyCode ]; } +const KEYCODES_WITH_NO_MODIFIER = new Set([ + "Delete", + ...functionKeyCodes +]); + /** * Check if IME (Input Method Editor) is composing * This is used to prevent keyboard shortcuts from firing during IME composition @@ -163,8 +171,8 @@ export function matchesShortcut(e: KeyboardEvent, shortcut: string): boolean { const expectedMeta = modifiers.includes('meta') || modifiers.includes('cmd') || modifiers.includes('command'); // Refuse key combinations that don't include modifiers because they interfere with the normal usage of the application. - // Function keys are an exception. - if (!(expectedCtrl || expectedAlt || expectedShift || expectedMeta) && !/f\d+/.test(key)) { + // Some keys such as function keys are an exception. + if (!(expectedCtrl || expectedAlt || expectedShift || expectedMeta) && !KEYCODES_WITH_NO_MODIFIER.has(e.code)) { return false; } From e971a9cb03fe45fa5c0b19a6e22953e8a9cdb68f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 15:46:53 +0300 Subject: [PATCH 2/6] fix(client): enter shortcut key not working --- apps/client/src/services/shortcuts.spec.ts | 8 +++++--- apps/client/src/services/shortcuts.ts | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/client/src/services/shortcuts.spec.ts b/apps/client/src/services/shortcuts.spec.ts index d9c2547a9..87f8ae489 100644 --- a/apps/client/src/services/shortcuts.spec.ts +++ b/apps/client/src/services/shortcuts.spec.ts @@ -158,9 +158,11 @@ describe("shortcuts", () => { event = createKeyboardEvent({ key: "F1", code: "F1", shiftKey: true }); expect(matchesShortcut(event, "Shift+F1")).toBeTruthy(); - // Delete - event = createKeyboardEvent({ key: "Delete", code: "Delete" }); - expect(matchesShortcut(event, "Delete")).toBeTruthy(); + // Special keys + for (const keyCode of [ "Delete", "Enter" ]) { + event = createKeyboardEvent({ key: keyCode, code: keyCode }); + expect(matchesShortcut(event, keyCode), `Key ${keyCode}`).toBeTruthy(); + } }); it("should handle alternative modifier names", () => { diff --git a/apps/client/src/services/shortcuts.ts b/apps/client/src/services/shortcuts.ts index 5e8cd52a5..94dd8893c 100644 --- a/apps/client/src/services/shortcuts.ts +++ b/apps/client/src/services/shortcuts.ts @@ -45,6 +45,7 @@ for (let i = 1; i <= 19; i++) { const KEYCODES_WITH_NO_MODIFIER = new Set([ "Delete", + "Enter", ...functionKeyCodes ]); From f442c56ed6aa0dfe369cdb7e4307ec6887b5eab9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 16:01:31 +0300 Subject: [PATCH 3/6] fix(client/options): missing ribbon widgets section in Appearance --- .../widgets/type_widgets/options/appearance.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx index e3ba25440..233186ffe 100644 --- a/apps/client/src/widgets/type_widgets/options/appearance.tsx +++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx @@ -90,6 +90,7 @@ export default function AppearanceSettings() { {isElectron() && } + ) } + +function RibbonOptions() { + const [ editedNotesOpenInRibbon, setEditedNotesOpenInRibbon ] = useTriliumOptionBool("editedNotesOpenInRibbon"); + + return ( + + + + ) +} From dbb90bdd2b78ae35367c0eac95e4421ab7ca81f0 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 16:05:32 +0300 Subject: [PATCH 4/6] fix(client/print): split button visible --- apps/client/src/stylesheets/print.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/stylesheets/print.css b/apps/client/src/stylesheets/print.css index f537911e5..114a52559 100644 --- a/apps/client/src/stylesheets/print.css +++ b/apps/client/src/stylesheets/print.css @@ -31,7 +31,7 @@ #center-pane > *:not(.split-note-container-widget), #right-pane, .title-row .note-icon-widget, -.title-row .button-widget, +.title-row .icon-action, .ribbon-container, .promoted-attributes-widget, .scroll-padding-widget, From f6898779bbf5e74255095c500deb1f3fcb714f2c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 16:09:32 +0300 Subject: [PATCH 5/6] fix(code): unable to search in read-only code notes --- apps/client/src/widgets/type_widgets/read_only_code.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/read_only_code.ts b/apps/client/src/widgets/type_widgets/read_only_code.ts index cdae4565e..78d84950a 100644 --- a/apps/client/src/widgets/type_widgets/read_only_code.ts +++ b/apps/client/src/widgets/type_widgets/read_only_code.ts @@ -45,14 +45,4 @@ export default class ReadOnlyCodeTypeWidget extends AbstractCodeTypeWidget { readOnly: true }; } - - async executeWithContentElementEvent({ resolve, ntxId }: EventData<"executeWithContentElement">) { - if (!this.isNoteContext(ntxId)) { - return; - } - - await this.initialized; - - resolve(this.$editor); - } } From ba91fbbe6b4fa2d56dcc4ed3790c9d6578c74b11 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 3 Oct 2025 16:46:26 +0300 Subject: [PATCH 6/6] fix(ribbon): formatting tab not activating automatically (closes #7185) --- apps/client/src/widgets/ribbon/Ribbon.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/client/src/widgets/ribbon/Ribbon.tsx b/apps/client/src/widgets/ribbon/Ribbon.tsx index ff908f00f..e47a78aee 100644 --- a/apps/client/src/widgets/ribbon/Ribbon.tsx +++ b/apps/client/src/widgets/ribbon/Ribbon.tsx @@ -51,6 +51,7 @@ const TAB_CONFIGURATION = numberObjectsInPlace([ show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic", toggleCommand: "toggleRibbonTabClassicEditor", content: FormattingToolbar, + activate: true, stayInDom: true }, {