fix(core): input focus preventing selection rect

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-19 16:44:29 +01:00
committed by Braks
parent ccf10ff779
commit 9ac4a0fbd2
+7 -1
View File
@@ -3,10 +3,16 @@ import type { KeyFilter, MaybeRef } from '@vueuse/core'
import { isBoolean, isFunction } from '@vueuse/core'
function isInputDOMNode(event: KeyboardEvent): boolean {
const target = event.composedPath()[0] as HTMLElement
const target = (event.composedPath?.()?.[0] || event.target) as HTMLElement
// we want to be able to do a multi selection event if we are in an input field
if (event.ctrlKey || event.metaKey || event.shiftKey) return false
const hasAttribute = isFunction(target.hasAttribute) ? target.hasAttribute('contenteditable') : false
const closest = isFunction(target.closest) ? target.closest('.nokey') : null
// when an input field is focused we don't want to trigger deletion or movement of nodes
return ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || hasAttribute || !!closest
}