mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 11:59:51 +08:00
fix: cmd+k key conflict
This commit is contained in:
@@ -28,6 +28,8 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const down = (e: KeyboardEvent) => {
|
const down = (e: KeyboardEvent) => {
|
||||||
if (e.key === 'k' && e.metaKey) {
|
if (e.key === 'k' && e.metaKey) {
|
||||||
|
console.log(e);
|
||||||
|
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (selection?.toString()) {
|
if (selection?.toString()) {
|
||||||
triggerQuickSearchModal(false);
|
triggerQuickSearchModal(false);
|
||||||
@@ -41,8 +43,9 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
|
|||||||
if (!open) {
|
if (!open) {
|
||||||
setQuery('');
|
setQuery('');
|
||||||
}
|
}
|
||||||
document.addEventListener('keydown', down);
|
document.addEventListener('keydown', down, { capture: true });
|
||||||
return () => document.removeEventListener('keydown', down);
|
return () =>
|
||||||
|
document.removeEventListener('keydown', down, { capture: true });
|
||||||
}, [open, triggerQuickSearchModal]);
|
}, [open, triggerQuickSearchModal]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user