mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 09:29:49 +02:00
Directly paste ClipboardEvents in Safari (#5362)
* Directly paste ClipboardEvents in Safari * Add changeset
This commit is contained in:
@@ -1619,9 +1619,13 @@ export const Editable = (props: EditableProps) => {
|
||||
// fall back to React's `onPaste` here instead.
|
||||
// COMPAT: Firefox, Chrome and Safari don't emit `beforeinput` events
|
||||
// when "paste without formatting" is used, so fallback. (2020/02/20)
|
||||
// COMPAT: Safari InputEvents generated by pasting won't include
|
||||
// application/x-slate-fragment items, so use the
|
||||
// ClipboardEvent here. (2023/03/15)
|
||||
if (
|
||||
!HAS_BEFORE_INPUT_SUPPORT ||
|
||||
isPlainTextOnlyPaste(event.nativeEvent)
|
||||
isPlainTextOnlyPaste(event.nativeEvent) ||
|
||||
IS_SAFARI
|
||||
) {
|
||||
event.preventDefault()
|
||||
ReactEditor.insertData(editor, event.clipboardData)
|
||||
|
Reference in New Issue
Block a user