@wordpress/block-editor
Version:
23 lines (22 loc) • 558 B
JavaScript
// packages/block-editor/src/utils/order-inserter-block-items.js
var orderInserterBlockItems = (items, priority) => {
if (!priority) {
return items;
}
items.sort(({ id: aName }, { id: bName }) => {
let aIndex = priority.indexOf(aName);
let bIndex = priority.indexOf(bName);
if (aIndex < 0) {
aIndex = priority.length;
}
if (bIndex < 0) {
bIndex = priority.length;
}
return aIndex - bIndex;
});
return items;
};
export {
orderInserterBlockItems
};
//# sourceMappingURL=order-inserter-block-items.js.map