mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
addressed comment
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
import {
|
||||
commandCenterKeyDownHandler,
|
||||
disableCommands,
|
||||
isKeyboardEventFromInput,
|
||||
isTargetInputLike,
|
||||
registerCommands
|
||||
} from './commands';
|
||||
import { RootPanel } from './panels';
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
const handleKeydown = (e: KeyboardEvent) => {
|
||||
if (!$subPanels.length) {
|
||||
if (isKeyboardEventFromInput(e)) return;
|
||||
if (isTargetInputLike(e.target)) return;
|
||||
keys = [...keys, e.key].slice(-10);
|
||||
resetKeys();
|
||||
}
|
||||
|
||||
@@ -100,17 +100,13 @@ const commandsEnabled = derived(disabledMap, ($disabledMap) => {
|
||||
return Array.from($disabledMap.values()).every((disabled) => !disabled);
|
||||
});
|
||||
|
||||
function isTargetInputLike(element: EventTarget | null) {
|
||||
export function isTargetInputLike(element: EventTarget | null) {
|
||||
if (!(element instanceof HTMLElement)) return false;
|
||||
return !!element.closest(
|
||||
'input,textarea,select,[contenteditable],[role="combobox"],[role="textbox"],[role="searchbox"],[data-command-center-ignore]'
|
||||
);
|
||||
}
|
||||
|
||||
export function isKeyboardEventFromInput(event: KeyboardEvent) {
|
||||
return isTargetInputLike(event.target);
|
||||
}
|
||||
|
||||
function getCommandRank(command: KeyedCommand) {
|
||||
const { keys, ctrl: meta, shift, alt } = command;
|
||||
const modifiers = [meta, shift, alt].filter(Boolean).length;
|
||||
@@ -214,7 +210,7 @@ export const commandCenterKeyDownHandler = derived(
|
||||
if (
|
||||
command.disabled ||
|
||||
!enabled ||
|
||||
isKeyboardEventFromInput(event) ||
|
||||
isTargetInputLike(event.target) ||
|
||||
$wizard.show
|
||||
) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user