@atlaskit/editor-plugin-floating-toolbar
Version:
Floating toolbar plugin for @atlaskit/editor-core
22 lines (21 loc) • 469 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findNode = findNode;
// find node in descendants by condition
function findNode(parent, predicate) {
var matchedNode;
parent.descendants(function (node) {
// dont run predicate if node already found
if (matchedNode) {
return false;
}
if (predicate(node)) {
matchedNode = node;
return false;
}
return true;
});
return matchedNode;
}