Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix(screen-protection): listen on both keydown and keyup for all shortcut groups
Marc Seitz0b580b7887af
diff --git a/components/view/ScreenProtection.tsx b/components/view/ScreenProtection.tsxindex c0c1fb38..2de6fc2c 100644--- a/components/view/ScreenProtection.tsx+++ b/components/view/ScreenProtection.tsx@@ -37,7 +37,7 @@ export const ScreenProtector = () => {},);- // Windows snipping/recording shortcuts (these emit `keydown`)+ // Windows snipping/recording shortcutsuseHotkeys(["meta+shift+s", // Win + Shift + S (Snipping Tool)@@ -48,12 +48,21 @@ export const ScreenProtector = () => {preventDefault: true,enableOnFormTags: true,enableOnContentEditable: true,+ keyup: true,+ keydown: true,},);- // macOS screenshot shortcuts+ // macOS screenshot shortcuts.+ // `meta+shift` (the shared prefix of the macOS screenshot shortcuts) is+ // intercepted on its own so the block overlay appears as soon as Cmd+Shift+ // is held — before the user presses 3/4/5. Unlike the full combos, the bare+ // modifier keydowns always reach the page (the OS only swallows the final+ // key), so this fires even when the specific combos don't. Trade-off: it+ // also fires on other Cmd+Shift shortcuts (e.g. reopen-tab).useHotkeys([+ "meta+shift", // Cmd + Shift (prefix for macOS screenshot shortcuts)"meta+shift+3", // Cmd + Shift + 3 (full screen)"meta+shift+4", // Cmd + Shift + 4 (selection)"meta+shift+5", // Cmd + Shift + 5 (screenshot utility)@@ -64,6 +73,8 @@ export const ScreenProtector = () => {preventDefault: true,enableOnFormTags: true,enableOnContentEditable: true,+ keyup: true,+ keydown: true,},);@@ -81,6 +92,8 @@ export const ScreenProtector = () => {preventDefault: true,enableOnFormTags: true,enableOnContentEditable: true,+ keyup: true,+ keydown: true,},);