@wordpress/block-library
Version:
Block library for the WordPress editor.
59 lines (53 loc) • 1.08 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { InnerBlocks } from '@wordpress/block-editor';
const deprecated = [{
attributes: {
verticalAlignment: {
type: 'string'
},
width: {
type: 'number',
min: 0,
max: 100
}
},
isEligible(_ref) {
let {
width
} = _ref;
return isFinite(width);
},
migrate(attributes) {
return { ...attributes,
width: `${attributes.width}%`
};
},
save(_ref2) {
let {
attributes
} = _ref2;
const {
verticalAlignment,
width
} = attributes;
const wrapperClasses = classnames({
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
const style = {
flexBasis: width + '%'
};
return createElement("div", {
className: wrapperClasses,
style: style
}, createElement(InnerBlocks.Content, null));
}
}];
export default deprecated;
//# sourceMappingURL=deprecated.js.map