Skip to content

Commit a7edb38

Browse files
committed
🩹(frontent) change selector to block cmd+k
Multiple ctrl+k could open the search modal, we change the selector, now if the toolbar is displayed we don't open the search modal.
1 parent fb5400c commit a7edb38

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => {
1515
const router = useRouter();
1616
const searchModal = useModal();
1717
const { authenticated } = useAuth();
18-
useCmdK(searchModal.open);
18+
useCmdK(() => {
19+
const isEditorToolbarOpen =
20+
document.getElementsByClassName('bn-formatting-toolbar').length > 0;
21+
if (isEditorToolbarOpen) {
22+
return;
23+
}
24+
25+
searchModal.open();
26+
});
1927
const { togglePanel } = useLeftPanelStore();
2028

2129
const { mutate: createDoc } = useCreateDoc({

src/frontend/apps/impress/src/hook/useCmdK.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ export const useCmdK = (callback: () => void) => {
66
if ((e.key === 'k' || e.key === 'K') && (e.metaKey || e.ctrlKey)) {
77
e.preventDefault();
88

9-
const isProseMirrorFocused =
10-
document.activeElement?.classList.contains('ProseMirror');
11-
if (isProseMirrorFocused) {
12-
return;
13-
}
14-
159
callback();
1610
}
1711
};

0 commit comments

Comments
 (0)