🚸(frontend) ctrl+k modal not when editor is focused
ctrl+k interaction was as well used in the editor. So if the user has a focus on the editor, we don't open the searchmodal.
This commit is contained in:
@@ -5,6 +5,13 @@ export const useCmdK = (callback: () => void) => {
|
||||
const down = (e: KeyboardEvent) => {
|
||||
if ((e.key === 'k' || e.key === 'K') && (e.metaKey || e.ctrlKey)) {
|
||||
e.preventDefault();
|
||||
|
||||
const isProseMirrorFocused =
|
||||
document.activeElement?.classList.contains('ProseMirror');
|
||||
if (isProseMirrorFocused) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user