mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-04-20 21:34:53 +02:00
fix: cut will remove void element when only select void element (#4107)
This commit is contained in:
parent
bf83f333e6
commit
5b24c86547
@ -703,8 +703,15 @@ export const Editable = (props: EditableProps) => {
|
||||
ReactEditor.setFragmentData(editor, event.clipboardData)
|
||||
const { selection } = editor
|
||||
|
||||
if (selection && Range.isExpanded(selection)) {
|
||||
Editor.deleteFragment(editor)
|
||||
if (selection) {
|
||||
if (Range.isExpanded(selection)) {
|
||||
Editor.deleteFragment(editor)
|
||||
} else {
|
||||
const node = Node.parent(editor, selection.anchor.path)
|
||||
if (Editor.isVoid(editor, node)) {
|
||||
Transforms.delete(editor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user