UNPKG

@wordpress/block-library

Version:
57 lines (56 loc) • 1.43 kB
// packages/block-library/src/block/deprecated.js const isObject = (obj) => typeof obj === "object" && !Array.isArray(obj) && obj !== null; var deprecated_default = [{ attributes: { ref: { type: "number" }, content: { type: "object" } }, supports: { customClassName: false, html: false, inserter: false, renaming: false }, isEligible({ content }) { return !!content && Object.keys(content).every((contentKey) => content[contentKey].values && isObject(content[contentKey].values)); }, migrate(attributes) { const { content, ...retainedAttributes } = attributes; if (content && Object.keys(content).length) { const updatedContent = { ...content }; for (const contentKey in content) updatedContent[contentKey] = content[contentKey].values; return { ...retainedAttributes, content: updatedContent }; } return attributes; } }, { attributes: { ref: { type: "number" }, overrides: { type: "object" } }, supports: { customClassName: false, html: false, inserter: false, renaming: false }, isEligible({ overrides }) { return !!overrides; }, migrate(attributes) { const { overrides, ...retainedAttributes } = attributes; const content = {}; Object.keys(overrides).forEach((id) => { content[id] = overrides[id]; }); return { ...retainedAttributes, content }; } }]; export { deprecated_default as default }; //# sourceMappingURL=deprecated.mjs.map