mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-17 13:38:37 +01:00
Directly paste ClipboardEvents in Safari (#5362)
* Directly paste ClipboardEvents in Safari * Add changeset
This commit is contained in:
parent
e587880964
commit
4399935690
5
.changeset/lovely-papayas-hug.md
Normal file
5
.changeset/lovely-papayas-hug.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Fix an issue where pastes in Safari wouldn't include application/x-slate-fragment data
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user