mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
committed by
Ian Storm Taylor
parent
ed593c732b
commit
cd0e577023
@@ -15,10 +15,18 @@ import findDOMNode from './find-dom-node'
|
|||||||
function findDOMPoint(key, offset) {
|
function findDOMPoint(key, offset) {
|
||||||
const el = findDOMNode(key)
|
const el = findDOMNode(key)
|
||||||
const window = getWindow(el)
|
const window = getWindow(el)
|
||||||
const iterator = window.document.createNodeIterator(el, NodeFilter.SHOW_TEXT)
|
|
||||||
let start = 0
|
let start = 0
|
||||||
let n
|
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()) {
|
while (n = iterator.nextNode()) {
|
||||||
const { length } = n.textContent
|
const { length } = n.textContent
|
||||||
const end = start + length
|
const end = start + length
|
||||||
|
Reference in New Issue
Block a user