1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-01 04:50:27 +02:00

Fix toSlatePoint wrong offset for void element. (#4057)

This commit is contained in:
Ulion
2021-04-01 05:59:34 +08:00
committed by GitHub
parent b7a56276b2
commit 286f4b2f55

View File

@@ -483,6 +483,9 @@ export const ReactEditor = {
textNode = leafNode.closest('[data-slate-node="text"]')!
domNode = leafNode
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