mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-14 03:03:58 +02:00
Unmemoize getFurthest and make it use getAncestors
This commit is contained in:
@@ -524,14 +524,13 @@ const Node = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
getFurthest(key, iterator) {
|
getFurthest(key, iterator) {
|
||||||
let node = this.assertDescendant(key)
|
let ancestors = this.getAncestors(key)
|
||||||
let furthest = null
|
if (!ancestors) {
|
||||||
|
throw new Error(`Could not find a descendant node with key "${key}".`)
|
||||||
while (node = this.getClosest(node, iterator)) {
|
|
||||||
furthest = node
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return furthest
|
// Exclude this node itself
|
||||||
|
return ancestors.rest().find(iterator)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1336,7 +1335,6 @@ memoize(Node, [
|
|||||||
'getDescendantDecorators',
|
'getDescendantDecorators',
|
||||||
'getFirstText',
|
'getFirstText',
|
||||||
'getFragmentAtRange',
|
'getFragmentAtRange',
|
||||||
'getFurthest',
|
|
||||||
'getFurthestBlock',
|
'getFurthestBlock',
|
||||||
'getFurthestInline',
|
'getFurthestInline',
|
||||||
'getHighestChild',
|
'getHighestChild',
|
||||||
|
Reference in New Issue
Block a user