Fix not being able to paste inside SearchBox input using Ctrl+V
This commit is contained in:
parent
b87286e002
commit
df853f6370
|
@ -23,7 +23,7 @@
|
|||
expandSelection,
|
||||
findRootPath
|
||||
} from '../../logic/selection.js'
|
||||
import { isContentEditableDiv } from '../../utils/domUtils.js'
|
||||
import { isContentEditableDiv, isTextInput } from '../../utils/domUtils.js'
|
||||
import {
|
||||
getIn,
|
||||
setIn,
|
||||
|
@ -458,7 +458,7 @@ findRootPath
|
|||
function handleKeyDown (event) {
|
||||
const combo = keyComboFromEvent(event)
|
||||
|
||||
if (!isContentEditableDiv(event.target)) {
|
||||
if (!isContentEditableDiv(event.target) && !isTextInput(event.target)) {
|
||||
if (combo === 'Ctrl+X' || combo === 'Command+X') {
|
||||
event.preventDefault()
|
||||
handleCut()
|
||||
|
|
|
@ -188,6 +188,12 @@ export function isContentEditableDiv (element) {
|
|||
return (element.nodeName === 'DIV' && element.contentEditable === 'true')
|
||||
}
|
||||
|
||||
// test whether a DOM element is an "input" with type "text"
|
||||
export function isTextInput (element) {
|
||||
console.log('element', element)
|
||||
return (element.nodeName === 'INPUT' && element.type && element.type.toLowerCase() === 'text')
|
||||
}
|
||||
|
||||
function hasAttribute (element, name, value) {
|
||||
return typeof element.getAttribute === 'function' && element.getAttribute(name) === value
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue