From 9878449e7f188d764a573b5d92eedccfddc338f1 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Wed, 1 Oct 2025 10:23:27 -1000 Subject: [PATCH] properly do strikethrough shortcut on multi blocks --- components/SelectionManager.tsx | 5 ++--- src/shortcuts.ts | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/SelectionManager.tsx b/components/SelectionManager.tsx index 1fbc46b9..034377c1 100644 --- a/components/SelectionManager.tsx +++ b/components/SelectionManager.tsx @@ -214,9 +214,8 @@ export function SelectionManager() { }, }, { - metaKey: true, - shift: true, - key: "X", + metaAndCtrl: true, + key: "x", handler: async () => { let [sortedBlocks] = await getSortedSelectionBound(); toggleMarkInBlocks( diff --git a/src/shortcuts.ts b/src/shortcuts.ts index fa66fff3..a4de0140 100644 --- a/src/shortcuts.ts +++ b/src/shortcuts.ts @@ -5,6 +5,7 @@ import { isMac } from "./utils/isDevice"; type Shortcut = { metaKey?: boolean; + metaAndCtrl?: boolean; altKey?: boolean; shift?: boolean; key: string | string[]; @@ -15,7 +16,10 @@ export function addShortcut(shortcuts: Shortcut | Shortcut[]) { for (let shortcut of [shortcuts].flat()) { if (e.shiftKey !== !!shortcut.shift) continue; if (e.altKey !== !!shortcut.altKey) continue; - if (!!shortcut.metaKey !== (isMac() ? e.metaKey : e.ctrlKey)) continue; + if (shortcut.metaAndCtrl) { + if (!(e.metaKey && e.ctrlKey)) continue; + } else if (!!shortcut.metaKey !== (isMac() ? e.metaKey : e.ctrlKey)) + continue; if (![shortcut.key].flat().includes(e.key)) continue; e.preventDefault(); return shortcut.handler(); -- 2.51.2