Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: blocks.js
* Ignored from documentation as the recommended usage for this action through setFreeformContentHandlerName from @wordpress/blocks.
[9500] Fix | Delete
*
[9501] Fix | Delete
* @ignore
[9502] Fix | Delete
*
[9503] Fix | Delete
* @param {string} name Block name.
[9504] Fix | Delete
*
[9505] Fix | Delete
* @return {Object} Action object.
[9506] Fix | Delete
*/
[9507] Fix | Delete
function setFreeformFallbackBlockName(name) {
[9508] Fix | Delete
return {
[9509] Fix | Delete
type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME',
[9510] Fix | Delete
name
[9511] Fix | Delete
};
[9512] Fix | Delete
}
[9513] Fix | Delete
[9514] Fix | Delete
/**
[9515] Fix | Delete
* Returns an action object used to set the name of the block used as a fallback
[9516] Fix | Delete
* for unregistered blocks.
[9517] Fix | Delete
* Ignored from documentation as the recommended usage for this action through setUnregisteredTypeHandlerName from @wordpress/blocks.
[9518] Fix | Delete
*
[9519] Fix | Delete
* @ignore
[9520] Fix | Delete
*
[9521] Fix | Delete
* @param {string} name Block name.
[9522] Fix | Delete
*
[9523] Fix | Delete
* @return {Object} Action object.
[9524] Fix | Delete
*/
[9525] Fix | Delete
function setUnregisteredFallbackBlockName(name) {
[9526] Fix | Delete
return {
[9527] Fix | Delete
type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME',
[9528] Fix | Delete
name
[9529] Fix | Delete
};
[9530] Fix | Delete
}
[9531] Fix | Delete
[9532] Fix | Delete
/**
[9533] Fix | Delete
* Returns an action object used to set the name of the block used
[9534] Fix | Delete
* when grouping other blocks
[9535] Fix | Delete
* eg: in "Group/Ungroup" interactions
[9536] Fix | Delete
* Ignored from documentation as the recommended usage for this action through setGroupingBlockName from @wordpress/blocks.
[9537] Fix | Delete
*
[9538] Fix | Delete
* @ignore
[9539] Fix | Delete
*
[9540] Fix | Delete
* @param {string} name Block name.
[9541] Fix | Delete
*
[9542] Fix | Delete
* @return {Object} Action object.
[9543] Fix | Delete
*/
[9544] Fix | Delete
function actions_setGroupingBlockName(name) {
[9545] Fix | Delete
return {
[9546] Fix | Delete
type: 'SET_GROUPING_BLOCK_NAME',
[9547] Fix | Delete
name
[9548] Fix | Delete
};
[9549] Fix | Delete
}
[9550] Fix | Delete
[9551] Fix | Delete
/**
[9552] Fix | Delete
* Returns an action object used to set block categories.
[9553] Fix | Delete
* Ignored from documentation as the recommended usage for this action through setCategories from @wordpress/blocks.
[9554] Fix | Delete
*
[9555] Fix | Delete
* @ignore
[9556] Fix | Delete
*
[9557] Fix | Delete
* @param {WPBlockCategory[]} categories Block categories.
[9558] Fix | Delete
*
[9559] Fix | Delete
* @return {Object} Action object.
[9560] Fix | Delete
*/
[9561] Fix | Delete
function setCategories(categories) {
[9562] Fix | Delete
return {
[9563] Fix | Delete
type: 'SET_CATEGORIES',
[9564] Fix | Delete
categories
[9565] Fix | Delete
};
[9566] Fix | Delete
}
[9567] Fix | Delete
[9568] Fix | Delete
/**
[9569] Fix | Delete
* Returns an action object used to update a category.
[9570] Fix | Delete
* Ignored from documentation as the recommended usage for this action through updateCategory from @wordpress/blocks.
[9571] Fix | Delete
*
[9572] Fix | Delete
* @ignore
[9573] Fix | Delete
*
[9574] Fix | Delete
* @param {string} slug Block category slug.
[9575] Fix | Delete
* @param {Object} category Object containing the category properties that should be updated.
[9576] Fix | Delete
*
[9577] Fix | Delete
* @return {Object} Action object.
[9578] Fix | Delete
*/
[9579] Fix | Delete
function updateCategory(slug, category) {
[9580] Fix | Delete
return {
[9581] Fix | Delete
type: 'UPDATE_CATEGORY',
[9582] Fix | Delete
slug,
[9583] Fix | Delete
category
[9584] Fix | Delete
};
[9585] Fix | Delete
}
[9586] Fix | Delete
[9587] Fix | Delete
/**
[9588] Fix | Delete
* Returns an action object used to add block collections
[9589] Fix | Delete
* Ignored from documentation as the recommended usage for this action through registerBlockCollection from @wordpress/blocks.
[9590] Fix | Delete
*
[9591] Fix | Delete
* @ignore
[9592] Fix | Delete
*
[9593] Fix | Delete
* @param {string} namespace The namespace of the blocks to put in the collection
[9594] Fix | Delete
* @param {string} title The title to display in the block inserter
[9595] Fix | Delete
* @param {Object} icon (optional) The icon to display in the block inserter
[9596] Fix | Delete
*
[9597] Fix | Delete
* @return {Object} Action object.
[9598] Fix | Delete
*/
[9599] Fix | Delete
function addBlockCollection(namespace, title, icon) {
[9600] Fix | Delete
return {
[9601] Fix | Delete
type: 'ADD_BLOCK_COLLECTION',
[9602] Fix | Delete
namespace,
[9603] Fix | Delete
title,
[9604] Fix | Delete
icon
[9605] Fix | Delete
};
[9606] Fix | Delete
}
[9607] Fix | Delete
[9608] Fix | Delete
/**
[9609] Fix | Delete
* Returns an action object used to remove block collections
[9610] Fix | Delete
* Ignored from documentation as the recommended usage for this action through unregisterBlockCollection from @wordpress/blocks.
[9611] Fix | Delete
*
[9612] Fix | Delete
* @ignore
[9613] Fix | Delete
*
[9614] Fix | Delete
* @param {string} namespace The namespace of the blocks to put in the collection
[9615] Fix | Delete
*
[9616] Fix | Delete
* @return {Object} Action object.
[9617] Fix | Delete
*/
[9618] Fix | Delete
function removeBlockCollection(namespace) {
[9619] Fix | Delete
return {
[9620] Fix | Delete
type: 'REMOVE_BLOCK_COLLECTION',
[9621] Fix | Delete
namespace
[9622] Fix | Delete
};
[9623] Fix | Delete
}
[9624] Fix | Delete
[9625] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/private-actions.js
[9626] Fix | Delete
/**
[9627] Fix | Delete
* Internal dependencies
[9628] Fix | Delete
*/
[9629] Fix | Delete
[9630] Fix | Delete
[9631] Fix | Delete
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
[9632] Fix | Delete
[9633] Fix | Delete
/**
[9634] Fix | Delete
* Add bootstrapped block type metadata to the store. These metadata usually come from
[9635] Fix | Delete
* the `block.json` file and are either statically boostrapped from the server, or
[9636] Fix | Delete
* passed as the `metadata` parameter to the `registerBlockType` function.
[9637] Fix | Delete
*
[9638] Fix | Delete
* @param {string} name Block name.
[9639] Fix | Delete
* @param {WPBlockType} blockType Block type metadata.
[9640] Fix | Delete
*/
[9641] Fix | Delete
function addBootstrappedBlockType(name, blockType) {
[9642] Fix | Delete
return {
[9643] Fix | Delete
type: 'ADD_BOOTSTRAPPED_BLOCK_TYPE',
[9644] Fix | Delete
name,
[9645] Fix | Delete
blockType
[9646] Fix | Delete
};
[9647] Fix | Delete
}
[9648] Fix | Delete
[9649] Fix | Delete
/**
[9650] Fix | Delete
* Add unprocessed block type settings to the store. These data are passed as the
[9651] Fix | Delete
* `settings` parameter to the client-side `registerBlockType` function.
[9652] Fix | Delete
*
[9653] Fix | Delete
* @param {string} name Block name.
[9654] Fix | Delete
* @param {WPBlockType} blockType Unprocessed block type settings.
[9655] Fix | Delete
*/
[9656] Fix | Delete
function addUnprocessedBlockType(name, blockType) {
[9657] Fix | Delete
return ({
[9658] Fix | Delete
dispatch
[9659] Fix | Delete
}) => {
[9660] Fix | Delete
dispatch({
[9661] Fix | Delete
type: 'ADD_UNPROCESSED_BLOCK_TYPE',
[9662] Fix | Delete
name,
[9663] Fix | Delete
blockType
[9664] Fix | Delete
});
[9665] Fix | Delete
const processedBlockType = dispatch(processBlockType(name, blockType));
[9666] Fix | Delete
if (!processedBlockType) {
[9667] Fix | Delete
return;
[9668] Fix | Delete
}
[9669] Fix | Delete
dispatch.addBlockTypes(processedBlockType);
[9670] Fix | Delete
};
[9671] Fix | Delete
}
[9672] Fix | Delete
[9673] Fix | Delete
/**
[9674] Fix | Delete
* Register new block bindings source.
[9675] Fix | Delete
*
[9676] Fix | Delete
* @param {string} source Name of the source to register.
[9677] Fix | Delete
*/
[9678] Fix | Delete
function registerBlockBindingsSource(source) {
[9679] Fix | Delete
return {
[9680] Fix | Delete
type: 'REGISTER_BLOCK_BINDINGS_SOURCE',
[9681] Fix | Delete
sourceName: source.name,
[9682] Fix | Delete
sourceLabel: source.label,
[9683] Fix | Delete
getValue: source.getValue,
[9684] Fix | Delete
setValue: source.setValue,
[9685] Fix | Delete
setValues: source.setValues,
[9686] Fix | Delete
getPlaceholder: source.getPlaceholder,
[9687] Fix | Delete
canUserEditValue: source.canUserEditValue
[9688] Fix | Delete
};
[9689] Fix | Delete
}
[9690] Fix | Delete
[9691] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/constants.js
[9692] Fix | Delete
const STORE_NAME = 'core/blocks';
[9693] Fix | Delete
[9694] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
[9695] Fix | Delete
/**
[9696] Fix | Delete
* WordPress dependencies
[9697] Fix | Delete
*/
[9698] Fix | Delete
[9699] Fix | Delete
[9700] Fix | Delete
/**
[9701] Fix | Delete
* Internal dependencies
[9702] Fix | Delete
*/
[9703] Fix | Delete
[9704] Fix | Delete
[9705] Fix | Delete
[9706] Fix | Delete
[9707] Fix | Delete
[9708] Fix | Delete
[9709] Fix | Delete
[9710] Fix | Delete
[9711] Fix | Delete
/**
[9712] Fix | Delete
* Store definition for the blocks namespace.
[9713] Fix | Delete
*
[9714] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
[9715] Fix | Delete
*
[9716] Fix | Delete
* @type {Object}
[9717] Fix | Delete
*/
[9718] Fix | Delete
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
[9719] Fix | Delete
reducer: reducer,
[9720] Fix | Delete
selectors: selectors_namespaceObject,
[9721] Fix | Delete
actions: actions_namespaceObject
[9722] Fix | Delete
});
[9723] Fix | Delete
(0,external_wp_data_namespaceObject.register)(store);
[9724] Fix | Delete
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
[9725] Fix | Delete
unlock(store).registerPrivateActions(private_actions_namespaceObject);
[9726] Fix | Delete
[9727] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
[9728] Fix | Delete
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
[9729] Fix | Delete
/* harmony default export */ const esm_browser_native = ({
[9730] Fix | Delete
randomUUID
[9731] Fix | Delete
});
[9732] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
[9733] Fix | Delete
// Unique ID creation requires a high quality random # generator. In the browser we therefore
[9734] Fix | Delete
// require the crypto API and do not support built-in fallback to lower quality random number
[9735] Fix | Delete
// generators (like Math.random()).
[9736] Fix | Delete
let getRandomValues;
[9737] Fix | Delete
const rnds8 = new Uint8Array(16);
[9738] Fix | Delete
function rng() {
[9739] Fix | Delete
// lazy load so that environments that need to polyfill have a chance to do so
[9740] Fix | Delete
if (!getRandomValues) {
[9741] Fix | Delete
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
[9742] Fix | Delete
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
[9743] Fix | Delete
[9744] Fix | Delete
if (!getRandomValues) {
[9745] Fix | Delete
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
[9746] Fix | Delete
}
[9747] Fix | Delete
}
[9748] Fix | Delete
[9749] Fix | Delete
return getRandomValues(rnds8);
[9750] Fix | Delete
}
[9751] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
[9752] Fix | Delete
[9753] Fix | Delete
/**
[9754] Fix | Delete
* Convert array of 16 byte values to UUID string format of the form:
[9755] Fix | Delete
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
[9756] Fix | Delete
*/
[9757] Fix | Delete
[9758] Fix | Delete
const byteToHex = [];
[9759] Fix | Delete
[9760] Fix | Delete
for (let i = 0; i < 256; ++i) {
[9761] Fix | Delete
byteToHex.push((i + 0x100).toString(16).slice(1));
[9762] Fix | Delete
}
[9763] Fix | Delete
[9764] Fix | Delete
function unsafeStringify(arr, offset = 0) {
[9765] Fix | Delete
// Note: Be careful editing this code! It's been tuned for performance
[9766] Fix | Delete
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
[9767] Fix | Delete
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
[9768] Fix | Delete
}
[9769] Fix | Delete
[9770] Fix | Delete
function stringify(arr, offset = 0) {
[9771] Fix | Delete
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
[9772] Fix | Delete
// of the following:
[9773] Fix | Delete
// - One or more input array values don't map to a hex octet (leading to
[9774] Fix | Delete
// "undefined" in the uuid)
[9775] Fix | Delete
// - Invalid input values for the RFC `version` or `variant` fields
[9776] Fix | Delete
[9777] Fix | Delete
if (!validate(uuid)) {
[9778] Fix | Delete
throw TypeError('Stringified UUID is invalid');
[9779] Fix | Delete
}
[9780] Fix | Delete
[9781] Fix | Delete
return uuid;
[9782] Fix | Delete
}
[9783] Fix | Delete
[9784] Fix | Delete
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
[9785] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
[9786] Fix | Delete
[9787] Fix | Delete
[9788] Fix | Delete
[9789] Fix | Delete
[9790] Fix | Delete
function v4(options, buf, offset) {
[9791] Fix | Delete
if (esm_browser_native.randomUUID && !buf && !options) {
[9792] Fix | Delete
return esm_browser_native.randomUUID();
[9793] Fix | Delete
}
[9794] Fix | Delete
[9795] Fix | Delete
options = options || {};
[9796] Fix | Delete
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
[9797] Fix | Delete
[9798] Fix | Delete
rnds[6] = rnds[6] & 0x0f | 0x40;
[9799] Fix | Delete
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
[9800] Fix | Delete
[9801] Fix | Delete
if (buf) {
[9802] Fix | Delete
offset = offset || 0;
[9803] Fix | Delete
[9804] Fix | Delete
for (let i = 0; i < 16; ++i) {
[9805] Fix | Delete
buf[offset + i] = rnds[i];
[9806] Fix | Delete
}
[9807] Fix | Delete
[9808] Fix | Delete
return buf;
[9809] Fix | Delete
}
[9810] Fix | Delete
[9811] Fix | Delete
return unsafeStringify(rnds);
[9812] Fix | Delete
}
[9813] Fix | Delete
[9814] Fix | Delete
/* harmony default export */ const esm_browser_v4 = (v4);
[9815] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
[9816] Fix | Delete
/**
[9817] Fix | Delete
* External dependencies
[9818] Fix | Delete
*/
[9819] Fix | Delete
[9820] Fix | Delete
[9821] Fix | Delete
/**
[9822] Fix | Delete
* WordPress dependencies
[9823] Fix | Delete
*/
[9824] Fix | Delete
[9825] Fix | Delete
[9826] Fix | Delete
/**
[9827] Fix | Delete
* Internal dependencies
[9828] Fix | Delete
*/
[9829] Fix | Delete
[9830] Fix | Delete
[9831] Fix | Delete
[9832] Fix | Delete
/**
[9833] Fix | Delete
* Returns a block object given its type and attributes.
[9834] Fix | Delete
*
[9835] Fix | Delete
* @param {string} name Block name.
[9836] Fix | Delete
* @param {Object} attributes Block attributes.
[9837] Fix | Delete
* @param {?Array} innerBlocks Nested blocks.
[9838] Fix | Delete
*
[9839] Fix | Delete
* @return {Object} Block object.
[9840] Fix | Delete
*/
[9841] Fix | Delete
function createBlock(name, attributes = {}, innerBlocks = []) {
[9842] Fix | Delete
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, attributes);
[9843] Fix | Delete
const clientId = esm_browser_v4();
[9844] Fix | Delete
[9845] Fix | Delete
// Blocks are stored with a unique ID, the assigned type name, the block
[9846] Fix | Delete
// attributes, and their inner blocks.
[9847] Fix | Delete
return {
[9848] Fix | Delete
clientId,
[9849] Fix | Delete
name,
[9850] Fix | Delete
isValid: true,
[9851] Fix | Delete
attributes: sanitizedAttributes,
[9852] Fix | Delete
innerBlocks
[9853] Fix | Delete
};
[9854] Fix | Delete
}
[9855] Fix | Delete
[9856] Fix | Delete
/**
[9857] Fix | Delete
* Given an array of InnerBlocks templates or Block Objects,
[9858] Fix | Delete
* returns an array of created Blocks from them.
[9859] Fix | Delete
* It handles the case of having InnerBlocks as Blocks by
[9860] Fix | Delete
* converting them to the proper format to continue recursively.
[9861] Fix | Delete
*
[9862] Fix | Delete
* @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates.
[9863] Fix | Delete
*
[9864] Fix | Delete
* @return {Object[]} Array of Block objects.
[9865] Fix | Delete
*/
[9866] Fix | Delete
function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) {
[9867] Fix | Delete
return innerBlocksOrTemplate.map(innerBlock => {
[9868] Fix | Delete
const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks];
[9869] Fix | Delete
const [name, attributes, innerBlocks = []] = innerBlockTemplate;
[9870] Fix | Delete
return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks));
[9871] Fix | Delete
});
[9872] Fix | Delete
}
[9873] Fix | Delete
[9874] Fix | Delete
/**
[9875] Fix | Delete
* Given a block object, returns a copy of the block object while sanitizing its attributes,
[9876] Fix | Delete
* optionally merging new attributes and/or replacing its inner blocks.
[9877] Fix | Delete
*
[9878] Fix | Delete
* @param {Object} block Block instance.
[9879] Fix | Delete
* @param {Object} mergeAttributes Block attributes.
[9880] Fix | Delete
* @param {?Array} newInnerBlocks Nested blocks.
[9881] Fix | Delete
*
[9882] Fix | Delete
* @return {Object} A cloned block.
[9883] Fix | Delete
*/
[9884] Fix | Delete
function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) {
[9885] Fix | Delete
const clientId = esm_browser_v4();
[9886] Fix | Delete
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(block.name, {
[9887] Fix | Delete
...block.attributes,
[9888] Fix | Delete
...mergeAttributes
[9889] Fix | Delete
});
[9890] Fix | Delete
return {
[9891] Fix | Delete
...block,
[9892] Fix | Delete
clientId,
[9893] Fix | Delete
attributes: sanitizedAttributes,
[9894] Fix | Delete
innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => __experimentalCloneSanitizedBlock(innerBlock))
[9895] Fix | Delete
};
[9896] Fix | Delete
}
[9897] Fix | Delete
[9898] Fix | Delete
/**
[9899] Fix | Delete
* Given a block object, returns a copy of the block object,
[9900] Fix | Delete
* optionally merging new attributes and/or replacing its inner blocks.
[9901] Fix | Delete
*
[9902] Fix | Delete
* @param {Object} block Block instance.
[9903] Fix | Delete
* @param {Object} mergeAttributes Block attributes.
[9904] Fix | Delete
* @param {?Array} newInnerBlocks Nested blocks.
[9905] Fix | Delete
*
[9906] Fix | Delete
* @return {Object} A cloned block.
[9907] Fix | Delete
*/
[9908] Fix | Delete
function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) {
[9909] Fix | Delete
const clientId = esm_browser_v4();
[9910] Fix | Delete
return {
[9911] Fix | Delete
...block,
[9912] Fix | Delete
clientId,
[9913] Fix | Delete
attributes: {
[9914] Fix | Delete
...block.attributes,
[9915] Fix | Delete
...mergeAttributes
[9916] Fix | Delete
},
[9917] Fix | Delete
innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => cloneBlock(innerBlock))
[9918] Fix | Delete
};
[9919] Fix | Delete
}
[9920] Fix | Delete
[9921] Fix | Delete
/**
[9922] Fix | Delete
* Returns a boolean indicating whether a transform is possible based on
[9923] Fix | Delete
* various bits of context.
[9924] Fix | Delete
*
[9925] Fix | Delete
* @param {Object} transform The transform object to validate.
[9926] Fix | Delete
* @param {string} direction Is this a 'from' or 'to' transform.
[9927] Fix | Delete
* @param {Array} blocks The blocks to transform from.
[9928] Fix | Delete
*
[9929] Fix | Delete
* @return {boolean} Is the transform possible?
[9930] Fix | Delete
*/
[9931] Fix | Delete
const isPossibleTransformForSource = (transform, direction, blocks) => {
[9932] Fix | Delete
if (!blocks.length) {
[9933] Fix | Delete
return false;
[9934] Fix | Delete
}
[9935] Fix | Delete
[9936] Fix | Delete
// If multiple blocks are selected, only multi block transforms
[9937] Fix | Delete
// or wildcard transforms are allowed.
[9938] Fix | Delete
const isMultiBlock = blocks.length > 1;
[9939] Fix | Delete
const firstBlockName = blocks[0].name;
[9940] Fix | Delete
const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
[9941] Fix | Delete
if (!isValidForMultiBlocks) {
[9942] Fix | Delete
return false;
[9943] Fix | Delete
}
[9944] Fix | Delete
[9945] Fix | Delete
// Check non-wildcard transforms to ensure that transform is valid
[9946] Fix | Delete
// for a block selection of multiple blocks of different types.
[9947] Fix | Delete
if (!isWildcardBlockTransform(transform) && !blocks.every(block => block.name === firstBlockName)) {
[9948] Fix | Delete
return false;
[9949] Fix | Delete
}
[9950] Fix | Delete
[9951] Fix | Delete
// Only consider 'block' type transforms as valid.
[9952] Fix | Delete
const isBlockType = transform.type === 'block';
[9953] Fix | Delete
if (!isBlockType) {
[9954] Fix | Delete
return false;
[9955] Fix | Delete
}
[9956] Fix | Delete
[9957] Fix | Delete
// Check if the transform's block name matches the source block (or is a wildcard)
[9958] Fix | Delete
// only if this is a transform 'from'.
[9959] Fix | Delete
const sourceBlock = blocks[0];
[9960] Fix | Delete
const hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
[9961] Fix | Delete
if (!hasMatchingName) {
[9962] Fix | Delete
return false;
[9963] Fix | Delete
}
[9964] Fix | Delete
[9965] Fix | Delete
// Don't allow single Grouping blocks to be transformed into
[9966] Fix | Delete
// a Grouping block.
[9967] Fix | Delete
if (!isMultiBlock && direction === 'from' && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) {
[9968] Fix | Delete
return false;
[9969] Fix | Delete
}
[9970] Fix | Delete
[9971] Fix | Delete
// If the transform has a `isMatch` function specified, check that it returns true.
[9972] Fix | Delete
if (!maybeCheckTransformIsMatch(transform, blocks)) {
[9973] Fix | Delete
return false;
[9974] Fix | Delete
}
[9975] Fix | Delete
return true;
[9976] Fix | Delete
};
[9977] Fix | Delete
[9978] Fix | Delete
/**
[9979] Fix | Delete
* Returns block types that the 'blocks' can be transformed into, based on
[9980] Fix | Delete
* 'from' transforms on other blocks.
[9981] Fix | Delete
*
[9982] Fix | Delete
* @param {Array} blocks The blocks to transform from.
[9983] Fix | Delete
*
[9984] Fix | Delete
* @return {Array} Block types that the blocks can be transformed into.
[9985] Fix | Delete
*/
[9986] Fix | Delete
const getBlockTypesForPossibleFromTransforms = blocks => {
[9987] Fix | Delete
if (!blocks.length) {
[9988] Fix | Delete
return [];
[9989] Fix | Delete
}
[9990] Fix | Delete
const allBlockTypes = getBlockTypes();
[9991] Fix | Delete
[9992] Fix | Delete
// filter all blocks to find those with a 'from' transform.
[9993] Fix | Delete
const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(blockType => {
[9994] Fix | Delete
const fromTransforms = getBlockTransforms('from', blockType.name);
[9995] Fix | Delete
return !!findTransform(fromTransforms, transform => {
[9996] Fix | Delete
return isPossibleTransformForSource(transform, 'from', blocks);
[9997] Fix | Delete
});
[9998] Fix | Delete
});
[9999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function