@wordpress/block-library
Version:
Block library for the WordPress editor.
61 lines (59 loc) • 2.01 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/block-library/src/navigation/edit/are-blocks-dirty.js
var are_blocks_dirty_exports = {};
__export(are_blocks_dirty_exports, {
areBlocksDirty: () => areBlocksDirty
});
module.exports = __toCommonJS(are_blocks_dirty_exports);
function areBlocksDirty(originalBlocks, blocks) {
return !isDeepEqual(originalBlocks, blocks, (prop, x) => {
if (x?.name === "core/page-list" && prop === "innerBlocks") {
return true;
}
});
}
var isDeepEqual = (x, y, shouldSkip) => {
if (x === y) {
return true;
} else if (typeof x === "object" && x !== null && x !== void 0 && typeof y === "object" && y !== null && y !== void 0) {
if (Object.keys(x).length !== Object.keys(y).length) {
return false;
}
for (const prop in x) {
if (y.hasOwnProperty(prop)) {
if (shouldSkip && shouldSkip(prop, x)) {
return true;
}
if (!isDeepEqual(x[prop], y[prop], shouldSkip)) {
return false;
}
} else {
return false;
}
}
return true;
}
return false;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
areBlocksDirty
});
//# sourceMappingURL=are-blocks-dirty.js.map