mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11: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.
|
// ancestor, so find it by going down from the nearest void parent.
|
||||||
|
|
||||||
leafNode = voidNode.querySelector('[data-slate-leaf]')!
|
leafNode = voidNode.querySelector('[data-slate-leaf]')!
|
||||||
textNode = leafNode.closest('[data-slate-node="text"]')!
|
if (!leafNode) {
|
||||||
domNode = leafNode
|
offset = 1
|
||||||
offset = domNode.textContent!.length
|
} 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
|
// COMPAT: If the parent node is a Slate zero-width space, editor is
|
||||||
|
Reference in New Issue
Block a user