@wordpress/block-library
Version:
Block library for the WordPress editor.
65 lines (56 loc) • 1.6 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _element = require("@wordpress/element");
var _blockEditor = require("@wordpress/block-editor");
/**
* WordPress dependencies
*/
// v1: Deprecate the initial version of the block which was called "Comments
// Query Loop" instead of "Comments".
const v1 = {
attributes: {
tagName: {
type: 'string',
default: 'div'
}
},
apiVersion: 2,
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
}
},
save(_ref) {
let {
attributes: {
tagName: Tag
}
} = _ref;
const blockProps = _blockEditor.useBlockProps.save();
const {
className
} = blockProps;
const classes = (className === null || className === void 0 ? void 0 : className.split(' ')) || []; // The ID of the previous version of the block
// didn't have the `wp-block-comments` class,
// so we need to remove it here in order to mimic it.
const newClasses = classes === null || classes === void 0 ? void 0 : classes.filter(cls => cls !== 'wp-block-comments');
const newBlockProps = { ...blockProps,
className: newClasses.join(' ')
};
return (0, _element.createElement)(Tag, newBlockProps, (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null));
}
};
var _default = [v1];
exports.default = _default;
//# sourceMappingURL=deprecated.js.map
;