mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
Allow Node.forEachDescendant to exit early
This commit is contained in:
@@ -170,7 +170,9 @@ const Node = {
|
||||
|
||||
forEachDescendant(iterator) {
|
||||
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)
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user