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,
|
expandSelection,
|
||||||
findRootPath
|
findRootPath
|
||||||
} from '../../logic/selection.js'
|
} from '../../logic/selection.js'
|
||||||
import { isContentEditableDiv } from '../../utils/domUtils.js'
|
import { isContentEditableDiv, isTextInput } from '../../utils/domUtils.js'
|
||||||
import {
|
import {
|
||||||
getIn,
|
getIn,
|
||||||
setIn,
|
setIn,
|
||||||
|
@ -458,7 +458,7 @@ findRootPath
|
||||||
function handleKeyDown (event) {
|
function handleKeyDown (event) {
|
||||||
const combo = keyComboFromEvent(event)
|
const combo = keyComboFromEvent(event)
|
||||||
|
|
||||||
if (!isContentEditableDiv(event.target)) {
|
if (!isContentEditableDiv(event.target) && !isTextInput(event.target)) {
|
||||||
if (combo === 'Ctrl+X' || combo === 'Command+X') {
|
if (combo === 'Ctrl+X' || combo === 'Command+X') {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
handleCut()
|
handleCut()
|
||||||
|
|
|
@ -188,6 +188,12 @@ export function isContentEditableDiv (element) {
|
||||||
return (element.nodeName === 'DIV' && element.contentEditable === 'true')
|
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) {
|
function hasAttribute (element, name, value) {
|
||||||
return typeof element.getAttribute === 'function' && element.getAttribute(name) === value
|
return typeof element.getAttribute === 'function' && element.getAttribute(name) === value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue