Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: blocks.js
}; // In test environments, pre-process the sprintf message to improve
[3500] Fix | Delete
// readability of error messages. We'd prefer to avoid pulling in this
[3501] Fix | Delete
// dependency in runtime environments, and it can be dropped by a combo
[3502] Fix | Delete
// of Webpack env substitution + UglifyJS dead code elimination.
[3503] Fix | Delete
[3504] Fix | Delete
[3505] Fix | Delete
if (false) {}
[3506] Fix | Delete
[3507] Fix | Delete
return log;
[3508] Fix | Delete
}
[3509] Fix | Delete
[3510] Fix | Delete
return {
[3511] Fix | Delete
// eslint-disable-next-line no-console
[3512] Fix | Delete
error: createLogHandler(console.error),
[3513] Fix | Delete
// eslint-disable-next-line no-console
[3514] Fix | Delete
warning: createLogHandler(console.warn),
[3515] Fix | Delete
getItems: function getItems() {
[3516] Fix | Delete
return [];
[3517] Fix | Delete
}
[3518] Fix | Delete
};
[3519] Fix | Delete
}
[3520] Fix | Delete
function createQueuedLogger() {
[3521] Fix | Delete
/**
[3522] Fix | Delete
* The list of enqueued log actions to print.
[3523] Fix | Delete
*
[3524] Fix | Delete
* @type {Array}
[3525] Fix | Delete
*/
[3526] Fix | Delete
var queue = [];
[3527] Fix | Delete
var logger = createLogger();
[3528] Fix | Delete
return {
[3529] Fix | Delete
error: function error() {
[3530] Fix | Delete
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
[3531] Fix | Delete
args[_key2] = arguments[_key2];
[3532] Fix | Delete
}
[3533] Fix | Delete
[3534] Fix | Delete
queue.push({
[3535] Fix | Delete
log: logger.error,
[3536] Fix | Delete
args: args
[3537] Fix | Delete
});
[3538] Fix | Delete
},
[3539] Fix | Delete
warning: function warning() {
[3540] Fix | Delete
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
[3541] Fix | Delete
args[_key3] = arguments[_key3];
[3542] Fix | Delete
}
[3543] Fix | Delete
[3544] Fix | Delete
queue.push({
[3545] Fix | Delete
log: logger.warning,
[3546] Fix | Delete
args: args
[3547] Fix | Delete
});
[3548] Fix | Delete
},
[3549] Fix | Delete
getItems: function getItems() {
[3550] Fix | Delete
return queue;
[3551] Fix | Delete
}
[3552] Fix | Delete
};
[3553] Fix | Delete
}
[3554] Fix | Delete
[3555] Fix | Delete
// EXTERNAL MODULE: external ["wp","isShallowEqual"]
[3556] Fix | Delete
var external_wp_isShallowEqual_ = __webpack_require__("rl8x");
[3557] Fix | Delete
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_);
[3558] Fix | Delete
[3559] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
[3560] Fix | Delete
var esm_extends = __webpack_require__("wx14");
[3561] Fix | Delete
[3562] Fix | Delete
// EXTERNAL MODULE: external ["wp","compose"]
[3563] Fix | Delete
var external_wp_compose_ = __webpack_require__("K9lf");
[3564] Fix | Delete
[3565] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/block-content-provider/index.js
[3566] Fix | Delete
[3567] Fix | Delete
[3568] Fix | Delete
[3569] Fix | Delete
/**
[3570] Fix | Delete
* WordPress dependencies
[3571] Fix | Delete
*/
[3572] Fix | Delete
[3573] Fix | Delete
[3574] Fix | Delete
/**
[3575] Fix | Delete
* Internal dependencies
[3576] Fix | Delete
*/
[3577] Fix | Delete
[3578] Fix | Delete
[3579] Fix | Delete
[3580] Fix | Delete
var _createContext = Object(external_wp_element_["createContext"])(function () {}),
[3581] Fix | Delete
Consumer = _createContext.Consumer,
[3582] Fix | Delete
Provider = _createContext.Provider;
[3583] Fix | Delete
/**
[3584] Fix | Delete
* An internal block component used in block content serialization to inject
[3585] Fix | Delete
* nested block content within the `save` implementation of the ancestor
[3586] Fix | Delete
* component in which it is nested. The component provides a pre-bound
[3587] Fix | Delete
* `BlockContent` component via context, which is used by the developer-facing
[3588] Fix | Delete
* `InnerBlocks.Content` component to render block content.
[3589] Fix | Delete
*
[3590] Fix | Delete
* @example
[3591] Fix | Delete
*
[3592] Fix | Delete
* ```jsx
[3593] Fix | Delete
* <BlockContentProvider innerBlocks={ innerBlocks }>
[3594] Fix | Delete
* { blockSaveElement }
[3595] Fix | Delete
* </BlockContentProvider>
[3596] Fix | Delete
* ```
[3597] Fix | Delete
*
[3598] Fix | Delete
* @param {Object} props Component props.
[3599] Fix | Delete
* @param {WPElement} props.children Block save result.
[3600] Fix | Delete
* @param {Array} props.innerBlocks Block(s) to serialize.
[3601] Fix | Delete
*
[3602] Fix | Delete
* @return {WPComponent} Element with BlockContent injected via context.
[3603] Fix | Delete
*/
[3604] Fix | Delete
[3605] Fix | Delete
[3606] Fix | Delete
var block_content_provider_BlockContentProvider = function BlockContentProvider(_ref) {
[3607] Fix | Delete
var children = _ref.children,
[3608] Fix | Delete
innerBlocks = _ref.innerBlocks;
[3609] Fix | Delete
[3610] Fix | Delete
var BlockContent = function BlockContent() {
[3611] Fix | Delete
// Value is an array of blocks, so defer to block serializer
[3612] Fix | Delete
var html = serialize(innerBlocks, {
[3613] Fix | Delete
isInnerBlocks: true
[3614] Fix | Delete
}); // Use special-cased raw HTML tag to avoid default escaping
[3615] Fix | Delete
[3616] Fix | Delete
return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, html);
[3617] Fix | Delete
};
[3618] Fix | Delete
[3619] Fix | Delete
return Object(external_wp_element_["createElement"])(Provider, {
[3620] Fix | Delete
value: BlockContent
[3621] Fix | Delete
}, children);
[3622] Fix | Delete
};
[3623] Fix | Delete
/**
[3624] Fix | Delete
* A Higher Order Component used to inject BlockContent using context to the
[3625] Fix | Delete
* wrapped component.
[3626] Fix | Delete
*
[3627] Fix | Delete
* @return {WPComponent} Enhanced component with injected BlockContent as prop.
[3628] Fix | Delete
*/
[3629] Fix | Delete
[3630] Fix | Delete
[3631] Fix | Delete
var withBlockContentContext = Object(external_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) {
[3632] Fix | Delete
return function (props) {
[3633] Fix | Delete
return Object(external_wp_element_["createElement"])(Consumer, null, function (context) {
[3634] Fix | Delete
return Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, {
[3635] Fix | Delete
BlockContent: context
[3636] Fix | Delete
}));
[3637] Fix | Delete
});
[3638] Fix | Delete
};
[3639] Fix | Delete
}, 'withBlockContentContext');
[3640] Fix | Delete
/* harmony default export */ var block_content_provider = (block_content_provider_BlockContentProvider);
[3641] Fix | Delete
[3642] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js
[3643] Fix | Delete
[3644] Fix | Delete
[3645] Fix | Delete
[3646] Fix | Delete
function serializer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
[3647] Fix | Delete
[3648] Fix | Delete
function serializer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { serializer_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { serializer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
[3649] Fix | Delete
[3650] Fix | Delete
/**
[3651] Fix | Delete
* External dependencies
[3652] Fix | Delete
*/
[3653] Fix | Delete
[3654] Fix | Delete
/**
[3655] Fix | Delete
* WordPress dependencies
[3656] Fix | Delete
*/
[3657] Fix | Delete
[3658] Fix | Delete
[3659] Fix | Delete
[3660] Fix | Delete
[3661] Fix | Delete
[3662] Fix | Delete
/**
[3663] Fix | Delete
* Internal dependencies
[3664] Fix | Delete
*/
[3665] Fix | Delete
[3666] Fix | Delete
[3667] Fix | Delete
[3668] Fix | Delete
[3669] Fix | Delete
/**
[3670] Fix | Delete
* @typedef {Object} WPBlockSerializationOptions Serialization Options.
[3671] Fix | Delete
*
[3672] Fix | Delete
* @property {boolean} isInnerBlocks Whether we are serializing inner blocks.
[3673] Fix | Delete
*/
[3674] Fix | Delete
[3675] Fix | Delete
/**
[3676] Fix | Delete
* Returns the block's default classname from its name.
[3677] Fix | Delete
*
[3678] Fix | Delete
* @param {string} blockName The block name.
[3679] Fix | Delete
*
[3680] Fix | Delete
* @return {string} The block's default class.
[3681] Fix | Delete
*/
[3682] Fix | Delete
[3683] Fix | Delete
function getBlockDefaultClassName(blockName) {
[3684] Fix | Delete
// Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature.
[3685] Fix | Delete
// Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
[3686] Fix | Delete
var className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, '');
[3687] Fix | Delete
return Object(external_wp_hooks_["applyFilters"])('blocks.getBlockDefaultClassName', className, blockName);
[3688] Fix | Delete
}
[3689] Fix | Delete
/**
[3690] Fix | Delete
* Returns the block's default menu item classname from its name.
[3691] Fix | Delete
*
[3692] Fix | Delete
* @param {string} blockName The block name.
[3693] Fix | Delete
*
[3694] Fix | Delete
* @return {string} The block's default menu item class.
[3695] Fix | Delete
*/
[3696] Fix | Delete
[3697] Fix | Delete
function getBlockMenuDefaultClassName(blockName) {
[3698] Fix | Delete
// Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature.
[3699] Fix | Delete
// Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
[3700] Fix | Delete
var className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, '');
[3701] Fix | Delete
return Object(external_wp_hooks_["applyFilters"])('blocks.getBlockMenuDefaultClassName', className, blockName);
[3702] Fix | Delete
}
[3703] Fix | Delete
var blockPropsProvider = {};
[3704] Fix | Delete
/**
[3705] Fix | Delete
* Call within a save function to get the props for the block wrapper.
[3706] Fix | Delete
*
[3707] Fix | Delete
* @param {Object} props Optional. Props to pass to the element.
[3708] Fix | Delete
*/
[3709] Fix | Delete
[3710] Fix | Delete
function getBlockProps() {
[3711] Fix | Delete
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
[3712] Fix | Delete
var blockType = blockPropsProvider.blockType,
[3713] Fix | Delete
attributes = blockPropsProvider.attributes;
[3714] Fix | Delete
return Object(external_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', serializer_objectSpread({}, props), blockType, attributes);
[3715] Fix | Delete
}
[3716] Fix | Delete
/**
[3717] Fix | Delete
* Given a block type containing a save render implementation and attributes, returns the
[3718] Fix | Delete
* enhanced element to be saved or string when raw HTML expected.
[3719] Fix | Delete
*
[3720] Fix | Delete
* @param {string|Object} blockTypeOrName Block type or name.
[3721] Fix | Delete
* @param {Object} attributes Block attributes.
[3722] Fix | Delete
* @param {?Array} innerBlocks Nested blocks.
[3723] Fix | Delete
*
[3724] Fix | Delete
* @return {Object|string} Save element or raw HTML string.
[3725] Fix | Delete
*/
[3726] Fix | Delete
[3727] Fix | Delete
function getSaveElement(blockTypeOrName, attributes) {
[3728] Fix | Delete
var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
[3729] Fix | Delete
var blockType = normalizeBlockType(blockTypeOrName);
[3730] Fix | Delete
var save = blockType.save; // Component classes are unsupported for save since serialization must
[3731] Fix | Delete
// occur synchronously. For improved interoperability with higher-order
[3732] Fix | Delete
// components which often return component class, emulate basic support.
[3733] Fix | Delete
[3734] Fix | Delete
if (save.prototype instanceof external_wp_element_["Component"]) {
[3735] Fix | Delete
var instance = new save({
[3736] Fix | Delete
attributes: attributes
[3737] Fix | Delete
});
[3738] Fix | Delete
save = instance.render.bind(instance);
[3739] Fix | Delete
}
[3740] Fix | Delete
[3741] Fix | Delete
blockPropsProvider.blockType = blockType;
[3742] Fix | Delete
blockPropsProvider.attributes = attributes;
[3743] Fix | Delete
var element = save({
[3744] Fix | Delete
attributes: attributes,
[3745] Fix | Delete
innerBlocks: innerBlocks
[3746] Fix | Delete
});
[3747] Fix | Delete
var hasLightBlockWrapper = blockType.apiVersion > 1 || registration_hasBlockSupport(blockType, 'lightBlockWrapper', false);
[3748] Fix | Delete
[3749] Fix | Delete
if (Object(external_lodash_["isObject"])(element) && Object(external_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps') && !hasLightBlockWrapper) {
[3750] Fix | Delete
/**
[3751] Fix | Delete
* Filters the props applied to the block save result element.
[3752] Fix | Delete
*
[3753] Fix | Delete
* @param {Object} props Props applied to save element.
[3754] Fix | Delete
* @param {WPBlock} blockType Block type definition.
[3755] Fix | Delete
* @param {Object} attributes Block attributes.
[3756] Fix | Delete
*/
[3757] Fix | Delete
var props = Object(external_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', serializer_objectSpread({}, element.props), blockType, attributes);
[3758] Fix | Delete
[3759] Fix | Delete
if (!external_wp_isShallowEqual_default()(props, element.props)) {
[3760] Fix | Delete
element = Object(external_wp_element_["cloneElement"])(element, props);
[3761] Fix | Delete
}
[3762] Fix | Delete
}
[3763] Fix | Delete
/**
[3764] Fix | Delete
* Filters the save result of a block during serialization.
[3765] Fix | Delete
*
[3766] Fix | Delete
* @param {WPElement} element Block save result.
[3767] Fix | Delete
* @param {WPBlock} blockType Block type definition.
[3768] Fix | Delete
* @param {Object} attributes Block attributes.
[3769] Fix | Delete
*/
[3770] Fix | Delete
[3771] Fix | Delete
[3772] Fix | Delete
element = Object(external_wp_hooks_["applyFilters"])('blocks.getSaveElement', element, blockType, attributes);
[3773] Fix | Delete
return Object(external_wp_element_["createElement"])(block_content_provider, {
[3774] Fix | Delete
innerBlocks: innerBlocks
[3775] Fix | Delete
}, element);
[3776] Fix | Delete
}
[3777] Fix | Delete
/**
[3778] Fix | Delete
* Given a block type containing a save render implementation and attributes, returns the
[3779] Fix | Delete
* static markup to be saved.
[3780] Fix | Delete
*
[3781] Fix | Delete
* @param {string|Object} blockTypeOrName Block type or name.
[3782] Fix | Delete
* @param {Object} attributes Block attributes.
[3783] Fix | Delete
* @param {?Array} innerBlocks Nested blocks.
[3784] Fix | Delete
*
[3785] Fix | Delete
* @return {string} Save content.
[3786] Fix | Delete
*/
[3787] Fix | Delete
[3788] Fix | Delete
function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
[3789] Fix | Delete
var blockType = normalizeBlockType(blockTypeOrName);
[3790] Fix | Delete
return Object(external_wp_element_["renderToString"])(getSaveElement(blockType, attributes, innerBlocks));
[3791] Fix | Delete
}
[3792] Fix | Delete
/**
[3793] Fix | Delete
* Returns attributes which are to be saved and serialized into the block
[3794] Fix | Delete
* comment delimiter.
[3795] Fix | Delete
*
[3796] Fix | Delete
* When a block exists in memory it contains as its attributes both those
[3797] Fix | Delete
* parsed the block comment delimiter _and_ those which matched from the
[3798] Fix | Delete
* contents of the block.
[3799] Fix | Delete
*
[3800] Fix | Delete
* This function returns only those attributes which are needed to persist and
[3801] Fix | Delete
* which cannot be matched from the block content.
[3802] Fix | Delete
*
[3803] Fix | Delete
* @param {Object<string,*>} blockType Block type.
[3804] Fix | Delete
* @param {Object<string,*>} attributes Attributes from in-memory block data.
[3805] Fix | Delete
*
[3806] Fix | Delete
* @return {Object<string,*>} Subset of attributes for comment serialization.
[3807] Fix | Delete
*/
[3808] Fix | Delete
[3809] Fix | Delete
function getCommentAttributes(blockType, attributes) {
[3810] Fix | Delete
return Object(external_lodash_["reduce"])(blockType.attributes, function (accumulator, attributeSchema, key) {
[3811] Fix | Delete
var value = attributes[key]; // Ignore undefined values.
[3812] Fix | Delete
[3813] Fix | Delete
if (undefined === value) {
[3814] Fix | Delete
return accumulator;
[3815] Fix | Delete
} // Ignore all attributes but the ones with an "undefined" source
[3816] Fix | Delete
// "undefined" source refers to attributes saved in the block comment.
[3817] Fix | Delete
[3818] Fix | Delete
[3819] Fix | Delete
if (attributeSchema.source !== undefined) {
[3820] Fix | Delete
return accumulator;
[3821] Fix | Delete
} // Ignore default value.
[3822] Fix | Delete
[3823] Fix | Delete
[3824] Fix | Delete
if ('default' in attributeSchema && attributeSchema.default === value) {
[3825] Fix | Delete
return accumulator;
[3826] Fix | Delete
} // Otherwise, include in comment set.
[3827] Fix | Delete
[3828] Fix | Delete
[3829] Fix | Delete
accumulator[key] = value;
[3830] Fix | Delete
return accumulator;
[3831] Fix | Delete
}, {});
[3832] Fix | Delete
}
[3833] Fix | Delete
/**
[3834] Fix | Delete
* Given an attributes object, returns a string in the serialized attributes
[3835] Fix | Delete
* format prepared for post content.
[3836] Fix | Delete
*
[3837] Fix | Delete
* @param {Object} attributes Attributes object.
[3838] Fix | Delete
*
[3839] Fix | Delete
* @return {string} Serialized attributes.
[3840] Fix | Delete
*/
[3841] Fix | Delete
[3842] Fix | Delete
function serializeAttributes(attributes) {
[3843] Fix | Delete
return JSON.stringify(attributes) // Don't break HTML comments.
[3844] Fix | Delete
.replace(/--/g, "\\u002d\\u002d") // Don't break non-standard-compliant tools.
[3845] Fix | Delete
.replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026") // Bypass server stripslashes behavior which would unescape stringify's
[3846] Fix | Delete
// escaping of quotation mark.
[3847] Fix | Delete
//
[3848] Fix | Delete
// See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/
[3849] Fix | Delete
.replace(/\\"/g, "\\u0022");
[3850] Fix | Delete
}
[3851] Fix | Delete
/**
[3852] Fix | Delete
* Given a block object, returns the Block's Inner HTML markup.
[3853] Fix | Delete
*
[3854] Fix | Delete
* @param {Object} block Block instance.
[3855] Fix | Delete
*
[3856] Fix | Delete
* @return {string} HTML.
[3857] Fix | Delete
*/
[3858] Fix | Delete
[3859] Fix | Delete
function getBlockContent(block) {
[3860] Fix | Delete
// @todo why not getBlockInnerHtml?
[3861] Fix | Delete
// If block was parsed as invalid or encounters an error while generating
[3862] Fix | Delete
// save content, use original content instead to avoid content loss. If a
[3863] Fix | Delete
// block contains nested content, exempt it from this condition because we
[3864] Fix | Delete
// otherwise have no access to its original content and content loss would
[3865] Fix | Delete
// still occur.
[3866] Fix | Delete
var saveContent = block.originalContent;
[3867] Fix | Delete
[3868] Fix | Delete
if (block.isValid || block.innerBlocks.length) {
[3869] Fix | Delete
try {
[3870] Fix | Delete
saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks);
[3871] Fix | Delete
} catch (error) {}
[3872] Fix | Delete
}
[3873] Fix | Delete
[3874] Fix | Delete
return saveContent;
[3875] Fix | Delete
}
[3876] Fix | Delete
/**
[3877] Fix | Delete
* Returns the content of a block, including comment delimiters.
[3878] Fix | Delete
*
[3879] Fix | Delete
* @param {string} rawBlockName Block name.
[3880] Fix | Delete
* @param {Object} attributes Block attributes.
[3881] Fix | Delete
* @param {string} content Block save content.
[3882] Fix | Delete
*
[3883] Fix | Delete
* @return {string} Comment-delimited block content.
[3884] Fix | Delete
*/
[3885] Fix | Delete
[3886] Fix | Delete
function getCommentDelimitedContent(rawBlockName, attributes, content) {
[3887] Fix | Delete
var serializedAttributes = !Object(external_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix.
[3888] Fix | Delete
[3889] Fix | Delete
var blockName = Object(external_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable.
[3890] Fix | Delete
[3891] Fix | Delete
if (!content) {
[3892] Fix | Delete
return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "/-->");
[3893] Fix | Delete
}
[3894] Fix | Delete
[3895] Fix | Delete
return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "-->\n") + content + "\n<!-- /wp:".concat(blockName, " -->");
[3896] Fix | Delete
}
[3897] Fix | Delete
/**
[3898] Fix | Delete
* Returns the content of a block, including comment delimiters, determining
[3899] Fix | Delete
* serialized attributes and content form from the current state of the block.
[3900] Fix | Delete
*
[3901] Fix | Delete
* @param {Object} block Block instance.
[3902] Fix | Delete
* @param {WPBlockSerializationOptions} options Serialization options.
[3903] Fix | Delete
*
[3904] Fix | Delete
* @return {string} Serialized block.
[3905] Fix | Delete
*/
[3906] Fix | Delete
[3907] Fix | Delete
function serializeBlock(block) {
[3908] Fix | Delete
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
[3909] Fix | Delete
_ref$isInnerBlocks = _ref.isInnerBlocks,
[3910] Fix | Delete
isInnerBlocks = _ref$isInnerBlocks === void 0 ? false : _ref$isInnerBlocks;
[3911] Fix | Delete
[3912] Fix | Delete
var blockName = block.name;
[3913] Fix | Delete
var saveContent = getBlockContent(block);
[3914] Fix | Delete
[3915] Fix | Delete
if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
[3916] Fix | Delete
return saveContent;
[3917] Fix | Delete
}
[3918] Fix | Delete
[3919] Fix | Delete
var blockType = registration_getBlockType(blockName);
[3920] Fix | Delete
var saveAttributes = getCommentAttributes(blockType, block.attributes);
[3921] Fix | Delete
return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
[3922] Fix | Delete
}
[3923] Fix | Delete
function __unstableSerializeAndClean(blocks) {
[3924] Fix | Delete
// A single unmodified default block is assumed to
[3925] Fix | Delete
// be equivalent to an empty post.
[3926] Fix | Delete
if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) {
[3927] Fix | Delete
blocks = [];
[3928] Fix | Delete
}
[3929] Fix | Delete
[3930] Fix | Delete
var content = serialize(blocks); // For compatibility, treat a post consisting of a
[3931] Fix | Delete
// single freeform block as legacy content and apply
[3932] Fix | Delete
// pre-block-editor removep'd content formatting.
[3933] Fix | Delete
[3934] Fix | Delete
if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName()) {
[3935] Fix | Delete
content = Object(external_wp_autop_["removep"])(content);
[3936] Fix | Delete
}
[3937] Fix | Delete
[3938] Fix | Delete
return content;
[3939] Fix | Delete
}
[3940] Fix | Delete
/**
[3941] Fix | Delete
* Takes a block or set of blocks and returns the serialized post content.
[3942] Fix | Delete
*
[3943] Fix | Delete
* @param {Array} blocks Block(s) to serialize.
[3944] Fix | Delete
* @param {WPBlockSerializationOptions} options Serialization options.
[3945] Fix | Delete
*
[3946] Fix | Delete
* @return {string} The post content.
[3947] Fix | Delete
*/
[3948] Fix | Delete
[3949] Fix | Delete
function serialize(blocks, options) {
[3950] Fix | Delete
return Object(external_lodash_["castArray"])(blocks).map(function (block) {
[3951] Fix | Delete
return serializeBlock(block, options);
[3952] Fix | Delete
}).join('\n\n');
[3953] Fix | Delete
}
[3954] Fix | Delete
[3955] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js
[3956] Fix | Delete
[3957] Fix | Delete
[3958] Fix | Delete
[3959] Fix | Delete
[3960] Fix | Delete
[3961] Fix | Delete
[3962] Fix | Delete
[3963] Fix | Delete
function validation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
[3964] Fix | Delete
[3965] Fix | Delete
function validation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { validation_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { validation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
[3966] Fix | Delete
[3967] Fix | Delete
/**
[3968] Fix | Delete
* External dependencies
[3969] Fix | Delete
*/
[3970] Fix | Delete
[3971] Fix | Delete
[3972] Fix | Delete
/**
[3973] Fix | Delete
* WordPress dependencies
[3974] Fix | Delete
*/
[3975] Fix | Delete
[3976] Fix | Delete
[3977] Fix | Delete
/**
[3978] Fix | Delete
* Internal dependencies
[3979] Fix | Delete
*/
[3980] Fix | Delete
[3981] Fix | Delete
[3982] Fix | Delete
[3983] Fix | Delete
[3984] Fix | Delete
/**
[3985] Fix | Delete
* Globally matches any consecutive whitespace
[3986] Fix | Delete
*
[3987] Fix | Delete
* @type {RegExp}
[3988] Fix | Delete
*/
[3989] Fix | Delete
[3990] Fix | Delete
var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
[3991] Fix | Delete
/**
[3992] Fix | Delete
* Matches a string containing only whitespace
[3993] Fix | Delete
*
[3994] Fix | Delete
* @type {RegExp}
[3995] Fix | Delete
*/
[3996] Fix | Delete
[3997] Fix | Delete
var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
[3998] Fix | Delete
/**
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function