mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 10:51:44 +02:00
fix(react-editor): text node spacer can be non-existant if editor is in readonly mode
This commit is contained in:
@@ -435,9 +435,13 @@ export const ReactEditor = {
|
||||
// ancestor, so find it by going down from the nearest void parent.
|
||||
|
||||
leafNode = voidNode.querySelector('[data-slate-leaf]')!
|
||||
textNode = leafNode.closest('[data-slate-node="text"]')!
|
||||
domNode = leafNode
|
||||
offset = domNode.textContent!.length
|
||||
if (!leafNode) {
|
||||
offset = 1
|
||||
} else {
|
||||
textNode = leafNode.closest('[data-slate-node="text"]')!
|
||||
domNode = leafNode
|
||||
offset = domNode.textContent!.length
|
||||
}
|
||||
}
|
||||
|
||||
// COMPAT: If the parent node is a Slate zero-width space, editor is
|
||||
|
Reference in New Issue
Block a user