1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-15 11:44:05 +02:00

Resolves iamstormtaylor/slate#3778: Check if editable target before handling paste event (#3779)

This commit is contained in:
Mitchell Busby
2020-07-11 02:30:26 +10:00
committed by GitHub
parent a35b8737b7
commit 68acd6b876

View File

@@ -946,11 +946,11 @@ export const Editable = (props: EditableProps) => {
// when "paste without formatting" option is used.
// This unfortunately needs to be handled with paste events instead.
if (
hasEditableTarget(editor, event.target) &&
!isEventHandled(event, attributes.onPaste) &&
(!HAS_BEFORE_INPUT_SUPPORT ||
isPlainTextOnlyPaste(event.nativeEvent)) &&
!readOnly &&
hasEditableTarget(editor, event.target)
!readOnly
) {
event.preventDefault()
ReactEditor.insertData(editor, event.clipboardData)