1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-13 18:53:59 +02:00

Unmemoize getFurthest and make it use getAncestors

This commit is contained in:
Soreine
2016-11-01 14:33:14 +01:00
parent 966e2c472d
commit c50b124d58

View File

@@ -524,14 +524,13 @@ const Node = {
*/
getFurthest(key, iterator) {
let node = this.assertDescendant(key)
let furthest = null
while (node = this.getClosest(node, iterator)) {
furthest = node
let ancestors = this.getAncestors(key)
if (!ancestors) {
throw new Error(`Could not find a descendant node with key "${key}".`)
}
return furthest
// Exclude this node itself
return ancestors.rest().find(iterator)
},
/**
@@ -1336,7 +1335,6 @@ memoize(Node, [
'getDescendantDecorators',
'getFirstText',
'getFragmentAtRange',
'getFurthest',
'getFurthestBlock',
'getFurthestInline',
'getHighestChild',