UNPKG

@wordpress/block-editor

Version:
35 lines (33 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addAttribute = addAttribute; var _hooks = require("@wordpress/hooks"); /** * WordPress dependencies */ /** * Filters registered block settings, extending attributes to include `lock`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function addAttribute(settings) { var _settings$attributes$; // Allow blocks to specify their own attribute definition with default values if needed. if ('type' in ((_settings$attributes$ = settings.attributes?.lock) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { return settings; } // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, lock: { type: 'object' } }; return settings; } (0, _hooks.addFilter)('blocks.registerBlockType', 'core/lock/addAttribute', addAttribute); //# sourceMappingURL=lock.js.map