@wordpress/block-library
Version:
Block library for the WordPress editor.
23 lines (22 loc) • 446 B
JavaScript
/**
* Migrates the current textAlign attribute,
*
* @param {Object} attributes The current attributes
* @return {Object} The updated attributes.
*/
export default function ( attributes ) {
const { textAlign, ...restAttributes } = attributes;
if ( ! textAlign ) {
return attributes;
}
return {
...restAttributes,
style: {
...attributes.style,
typography: {
...attributes.style?.typography,
textAlign,
},
},
};
}