mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 18:24:03 +02:00
Fix toSlatePoint wrong offset for void element. (#4057)
This commit is contained in:
@@ -483,6 +483,9 @@ export const ReactEditor = {
|
|||||||
textNode = leafNode.closest('[data-slate-node="text"]')!
|
textNode = leafNode.closest('[data-slate-node="text"]')!
|
||||||
domNode = leafNode
|
domNode = leafNode
|
||||||
offset = domNode.textContent!.length
|
offset = domNode.textContent!.length
|
||||||
|
domNode.querySelectorAll('[data-slate-zero-width]').forEach(el => {
|
||||||
|
offset -= el.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