mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 10:51:44 +02:00
Allow Node.forEachDescendant to exit early
This commit is contained in:
@@ -170,7 +170,9 @@ const Node = {
|
|||||||
|
|
||||||
forEachDescendant(iterator) {
|
forEachDescendant(iterator) {
|
||||||
return this.nodes.forEach((child, i, nodes) => {
|
return this.nodes.forEach((child, i, nodes) => {
|
||||||
iterator(child, i, nodes)
|
if (iterator(child, i, nodes) === false) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (child.kind != 'text') child.forEachDescendant(iterator)
|
if (child.kind != 'text') child.forEachDescendant(iterator)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user