Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
Add Cmd+K/Ctrl+K shortcut to focus and highlight document search
Marc Seitz1256d541d528
diff --git a/components/search-box.tsx b/components/search-box.tsxindex 351bd627..25dca122 100644--- a/components/search-box.tsx+++ b/components/search-box.tsx@@ -58,6 +58,17 @@ const SearchBox = forwardRef(const onKeyDown = useCallback((e: KeyboardEvent) => {const target = e.target as HTMLElement;++ // Cmd+K (macOS) / Ctrl+K (Windows/Linux) focuses the search input and+ // selects any existing text so the field is highlighted. This works+ // even while typing in another input, just like a global command.+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {+ e.preventDefault();+ inputRef.current?.focus();+ inputRef.current?.select();+ return;+ }+// only focus on filter input when:// - user is not typing in an input or textarea// - there is no existing modal backdrop (i.e. no other modal is open)