mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 04:04:06 +02:00
Resolves iamstormtaylor/slate#3778: Check if editable target before handling paste event (#3779)
This commit is contained in:
@@ -946,11 +946,11 @@ export const Editable = (props: EditableProps) => {
|
|||||||
// when "paste without formatting" option is used.
|
// when "paste without formatting" option is used.
|
||||||
// This unfortunately needs to be handled with paste events instead.
|
// This unfortunately needs to be handled with paste events instead.
|
||||||
if (
|
if (
|
||||||
|
hasEditableTarget(editor, event.target) &&
|
||||||
!isEventHandled(event, attributes.onPaste) &&
|
!isEventHandled(event, attributes.onPaste) &&
|
||||||
(!HAS_BEFORE_INPUT_SUPPORT ||
|
(!HAS_BEFORE_INPUT_SUPPORT ||
|
||||||
isPlainTextOnlyPaste(event.nativeEvent)) &&
|
isPlainTextOnlyPaste(event.nativeEvent)) &&
|
||||||
!readOnly &&
|
!readOnly
|
||||||
hasEditableTarget(editor, event.target)
|
|
||||||
) {
|
) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
ReactEditor.insertData(editor, event.clipboardData)
|
ReactEditor.insertData(editor, event.clipboardData)
|
||||||
|
Reference in New Issue
Block a user