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:
@@ -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',
|
||||
|
Reference in New Issue
Block a user