@lyra/form-builder
Version:
Lyra form builder
20 lines (19 loc) • 527 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findInlineByAnnotationKey;
function findInlineByAnnotationKey(key, document) {
return document.filterDescendants(desc => {
if (desc.object !== 'inline') {
return false;
}
const annotations = desc.data.get('annotations');
if (!annotations) {
return false;
}
return Object.keys(annotations).find(annotationName => {
return annotations[annotationName]._key === key;
});
}).get(0);
}