UNPKG

@gechiui/block-editor

Version:
43 lines (34 loc) 964 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addAttribute = addAttribute; var _lodash = require("lodash"); var _hooks = require("@gechiui/hooks"); /** * External dependencies */ /** * GeChiUI dependencies */ /** * Filters registered block settings, extending attributes to include `lock`. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function addAttribute(settings) { // allow blocks to specify their own attribute definition with default values if needed. if ((0, _lodash.has)(settings.attributes, ['lock', 'type'])) { 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