@wordpress/block-editor
Version:
27 lines (24 loc) • 751 B
JavaScript
;
var _hooks = require("@wordpress/hooks");
var _blocks = require("@wordpress/blocks");
/**
* WordPress dependencies
*/
const hasSettingsSupport = blockType => (0, _blocks.hasBlockSupport)(blockType, '__experimentalSettings', false);
function addAttribute(settings) {
if (!hasSettingsSupport(settings)) {
return settings;
}
// Allow blocks to specify their own attribute definition with default values if needed.
if (!settings?.attributes?.settings) {
settings.attributes = {
...settings.attributes,
settings: {
type: 'object'
}
};
}
return settings;
}
(0, _hooks.addFilter)('blocks.registerBlockType', 'core/settings/addAttribute', addAttribute);
//# sourceMappingURL=settings.js.map