mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-13 11:44:55 +01:00
parent
ed593c732b
commit
cd0e577023
@ -15,9 +15,17 @@ import findDOMNode from './find-dom-node'
|
||||
function findDOMPoint(key, offset) {
|
||||
const el = findDOMNode(key)
|
||||
const window = getWindow(el)
|
||||
const iterator = window.document.createNodeIterator(el, NodeFilter.SHOW_TEXT)
|
||||
let start = 0
|
||||
let n
|
||||
|
||||
// COMPAT: In IE, this method's arguments are not optional, so we have to
|
||||
// pass in all four even though the last two are defaults. (2017/10/25)
|
||||
const iterator = window.document.createNodeIterator(
|
||||
el,
|
||||
NodeFilter.SHOW_TEXT,
|
||||
() => NodeFilter.FILTER_ACCEPT,
|
||||
false
|
||||
)
|
||||
|
||||
while (n = iterator.nextNode()) {
|
||||
const { length } = n.textContent
|
||||
|
Loading…
x
Reference in New Issue
Block a user