diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 054b96291..8c7260f35 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -7,6 +7,7 @@ import { Range, Text, Transforms, + Path, } from 'slate' import throttle from 'lodash/throttle' import scrollIntoView from 'scroll-into-view-if-needed' @@ -554,8 +555,16 @@ export const Editable = (props: EditableProps) => { const node = ReactEditor.toSlateNode(editor, event.target) const path = ReactEditor.findPath(editor, node) const start = Editor.start(editor, path) + const end = Editor.end(editor, path) - if (Editor.void(editor, { at: start })) { + const startVoid = Editor.void(editor, { at: start }) + const endVoid = Editor.void(editor, { at: end }) + + if ( + startVoid && + endVoid && + Path.equals(startVoid[1], endVoid[1]) + ) { const range = Editor.range(editor, start) Transforms.select(editor, range) }