UNPKG

@wordpress/block-library

Version:
36 lines (35 loc) 963 B
// packages/block-library/src/navigation/edit/are-blocks-dirty.js 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; }; export { areBlocksDirty }; //# sourceMappingURL=are-blocks-dirty.js.map