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: block-editor.js
function moveTo(array, from, to, count = 1) {
[8500] Fix | Delete
const withoutMovedElements = [...array];
[8501] Fix | Delete
withoutMovedElements.splice(from, count);
[8502] Fix | Delete
return insertAt(withoutMovedElements, array.slice(from, from + count), to);
[8503] Fix | Delete
}
[8504] Fix | Delete
[8505] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/reducer.js
[8506] Fix | Delete
/**
[8507] Fix | Delete
* External dependencies
[8508] Fix | Delete
*/
[8509] Fix | Delete
[8510] Fix | Delete
[8511] Fix | Delete
/**
[8512] Fix | Delete
* WordPress dependencies
[8513] Fix | Delete
*/
[8514] Fix | Delete
[8515] Fix | Delete
[8516] Fix | Delete
[8517] Fix | Delete
/**
[8518] Fix | Delete
* Internal dependencies
[8519] Fix | Delete
*/
[8520] Fix | Delete
[8521] Fix | Delete
[8522] Fix | Delete
const identity = x => x;
[8523] Fix | Delete
[8524] Fix | Delete
/**
[8525] Fix | Delete
* Given an array of blocks, returns an object where each key is a nesting
[8526] Fix | Delete
* context, the value of which is an array of block client IDs existing within
[8527] Fix | Delete
* that nesting context.
[8528] Fix | Delete
*
[8529] Fix | Delete
* @param {Array} blocks Blocks to map.
[8530] Fix | Delete
* @param {?string} rootClientId Assumed root client ID.
[8531] Fix | Delete
*
[8532] Fix | Delete
* @return {Object} Block order map object.
[8533] Fix | Delete
*/
[8534] Fix | Delete
function mapBlockOrder(blocks, rootClientId = '') {
[8535] Fix | Delete
const result = new Map();
[8536] Fix | Delete
const current = [];
[8537] Fix | Delete
result.set(rootClientId, current);
[8538] Fix | Delete
blocks.forEach(block => {
[8539] Fix | Delete
const {
[8540] Fix | Delete
clientId,
[8541] Fix | Delete
innerBlocks
[8542] Fix | Delete
} = block;
[8543] Fix | Delete
current.push(clientId);
[8544] Fix | Delete
mapBlockOrder(innerBlocks, clientId).forEach((order, subClientId) => {
[8545] Fix | Delete
result.set(subClientId, order);
[8546] Fix | Delete
});
[8547] Fix | Delete
});
[8548] Fix | Delete
return result;
[8549] Fix | Delete
}
[8550] Fix | Delete
[8551] Fix | Delete
/**
[8552] Fix | Delete
* Given an array of blocks, returns an object where each key contains
[8553] Fix | Delete
* the clientId of the block and the value is the parent of the block.
[8554] Fix | Delete
*
[8555] Fix | Delete
* @param {Array} blocks Blocks to map.
[8556] Fix | Delete
* @param {?string} rootClientId Assumed root client ID.
[8557] Fix | Delete
*
[8558] Fix | Delete
* @return {Object} Block order map object.
[8559] Fix | Delete
*/
[8560] Fix | Delete
function mapBlockParents(blocks, rootClientId = '') {
[8561] Fix | Delete
const result = [];
[8562] Fix | Delete
const stack = [[rootClientId, blocks]];
[8563] Fix | Delete
while (stack.length) {
[8564] Fix | Delete
const [parent, currentBlocks] = stack.shift();
[8565] Fix | Delete
currentBlocks.forEach(({
[8566] Fix | Delete
innerBlocks,
[8567] Fix | Delete
...block
[8568] Fix | Delete
}) => {
[8569] Fix | Delete
result.push([block.clientId, parent]);
[8570] Fix | Delete
if (innerBlocks?.length) {
[8571] Fix | Delete
stack.push([block.clientId, innerBlocks]);
[8572] Fix | Delete
}
[8573] Fix | Delete
});
[8574] Fix | Delete
}
[8575] Fix | Delete
return result;
[8576] Fix | Delete
}
[8577] Fix | Delete
[8578] Fix | Delete
/**
[8579] Fix | Delete
* Helper method to iterate through all blocks, recursing into inner blocks,
[8580] Fix | Delete
* applying a transformation function to each one.
[8581] Fix | Delete
* Returns a flattened object with the transformed blocks.
[8582] Fix | Delete
*
[8583] Fix | Delete
* @param {Array} blocks Blocks to flatten.
[8584] Fix | Delete
* @param {Function} transform Transforming function to be applied to each block.
[8585] Fix | Delete
*
[8586] Fix | Delete
* @return {Array} Flattened object.
[8587] Fix | Delete
*/
[8588] Fix | Delete
function flattenBlocks(blocks, transform = identity) {
[8589] Fix | Delete
const result = [];
[8590] Fix | Delete
const stack = [...blocks];
[8591] Fix | Delete
while (stack.length) {
[8592] Fix | Delete
const {
[8593] Fix | Delete
innerBlocks,
[8594] Fix | Delete
...block
[8595] Fix | Delete
} = stack.shift();
[8596] Fix | Delete
stack.push(...innerBlocks);
[8597] Fix | Delete
result.push([block.clientId, transform(block)]);
[8598] Fix | Delete
}
[8599] Fix | Delete
return result;
[8600] Fix | Delete
}
[8601] Fix | Delete
function getFlattenedClientIds(blocks) {
[8602] Fix | Delete
const result = {};
[8603] Fix | Delete
const stack = [...blocks];
[8604] Fix | Delete
while (stack.length) {
[8605] Fix | Delete
const {
[8606] Fix | Delete
innerBlocks,
[8607] Fix | Delete
...block
[8608] Fix | Delete
} = stack.shift();
[8609] Fix | Delete
stack.push(...innerBlocks);
[8610] Fix | Delete
result[block.clientId] = true;
[8611] Fix | Delete
}
[8612] Fix | Delete
return result;
[8613] Fix | Delete
}
[8614] Fix | Delete
[8615] Fix | Delete
/**
[8616] Fix | Delete
* Given an array of blocks, returns an object containing all blocks, without
[8617] Fix | Delete
* attributes, recursing into inner blocks. Keys correspond to the block client
[8618] Fix | Delete
* ID, the value of which is the attributes object.
[8619] Fix | Delete
*
[8620] Fix | Delete
* @param {Array} blocks Blocks to flatten.
[8621] Fix | Delete
*
[8622] Fix | Delete
* @return {Array} Flattened block attributes object.
[8623] Fix | Delete
*/
[8624] Fix | Delete
function getFlattenedBlocksWithoutAttributes(blocks) {
[8625] Fix | Delete
return flattenBlocks(blocks, block => {
[8626] Fix | Delete
const {
[8627] Fix | Delete
attributes,
[8628] Fix | Delete
...restBlock
[8629] Fix | Delete
} = block;
[8630] Fix | Delete
return restBlock;
[8631] Fix | Delete
});
[8632] Fix | Delete
}
[8633] Fix | Delete
[8634] Fix | Delete
/**
[8635] Fix | Delete
* Given an array of blocks, returns an object containing all block attributes,
[8636] Fix | Delete
* recursing into inner blocks. Keys correspond to the block client ID, the
[8637] Fix | Delete
* value of which is the attributes object.
[8638] Fix | Delete
*
[8639] Fix | Delete
* @param {Array} blocks Blocks to flatten.
[8640] Fix | Delete
*
[8641] Fix | Delete
* @return {Array} Flattened block attributes object.
[8642] Fix | Delete
*/
[8643] Fix | Delete
function getFlattenedBlockAttributes(blocks) {
[8644] Fix | Delete
return flattenBlocks(blocks, block => block.attributes);
[8645] Fix | Delete
}
[8646] Fix | Delete
[8647] Fix | Delete
/**
[8648] Fix | Delete
* Returns true if the two object arguments have the same keys, or false
[8649] Fix | Delete
* otherwise.
[8650] Fix | Delete
*
[8651] Fix | Delete
* @param {Object} a First object.
[8652] Fix | Delete
* @param {Object} b Second object.
[8653] Fix | Delete
*
[8654] Fix | Delete
* @return {boolean} Whether the two objects have the same keys.
[8655] Fix | Delete
*/
[8656] Fix | Delete
function hasSameKeys(a, b) {
[8657] Fix | Delete
return es6_default()(Object.keys(a), Object.keys(b));
[8658] Fix | Delete
}
[8659] Fix | Delete
[8660] Fix | Delete
/**
[8661] Fix | Delete
* Returns true if, given the currently dispatching action and the previously
[8662] Fix | Delete
* dispatched action, the two actions are updating the same block attribute, or
[8663] Fix | Delete
* false otherwise.
[8664] Fix | Delete
*
[8665] Fix | Delete
* @param {Object} action Currently dispatching action.
[8666] Fix | Delete
* @param {Object} lastAction Previously dispatched action.
[8667] Fix | Delete
*
[8668] Fix | Delete
* @return {boolean} Whether actions are updating the same block attribute.
[8669] Fix | Delete
*/
[8670] Fix | Delete
function isUpdatingSameBlockAttribute(action, lastAction) {
[8671] Fix | Delete
return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && es6_default()(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
[8672] Fix | Delete
}
[8673] Fix | Delete
function updateBlockTreeForBlocks(state, blocks) {
[8674] Fix | Delete
const treeToUpdate = state.tree;
[8675] Fix | Delete
const stack = [...blocks];
[8676] Fix | Delete
const flattenedBlocks = [...blocks];
[8677] Fix | Delete
while (stack.length) {
[8678] Fix | Delete
const block = stack.shift();
[8679] Fix | Delete
stack.push(...block.innerBlocks);
[8680] Fix | Delete
flattenedBlocks.push(...block.innerBlocks);
[8681] Fix | Delete
}
[8682] Fix | Delete
// Create objects before mutating them, that way it's always defined.
[8683] Fix | Delete
for (const block of flattenedBlocks) {
[8684] Fix | Delete
treeToUpdate.set(block.clientId, {});
[8685] Fix | Delete
}
[8686] Fix | Delete
for (const block of flattenedBlocks) {
[8687] Fix | Delete
treeToUpdate.set(block.clientId, Object.assign(treeToUpdate.get(block.clientId), {
[8688] Fix | Delete
...state.byClientId.get(block.clientId),
[8689] Fix | Delete
attributes: state.attributes.get(block.clientId),
[8690] Fix | Delete
innerBlocks: block.innerBlocks.map(subBlock => treeToUpdate.get(subBlock.clientId))
[8691] Fix | Delete
}));
[8692] Fix | Delete
}
[8693] Fix | Delete
}
[8694] Fix | Delete
function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) {
[8695] Fix | Delete
const treeToUpdate = state.tree;
[8696] Fix | Delete
const uncontrolledParents = new Set([]);
[8697] Fix | Delete
const controlledParents = new Set();
[8698] Fix | Delete
for (const clientId of updatedClientIds) {
[8699] Fix | Delete
let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
[8700] Fix | Delete
do {
[8701] Fix | Delete
if (state.controlledInnerBlocks[current]) {
[8702] Fix | Delete
// Should stop on controlled blocks.
[8703] Fix | Delete
// If we reach a controlled parent, break out of the loop.
[8704] Fix | Delete
controlledParents.add(current);
[8705] Fix | Delete
break;
[8706] Fix | Delete
} else {
[8707] Fix | Delete
// Else continue traversing up through parents.
[8708] Fix | Delete
uncontrolledParents.add(current);
[8709] Fix | Delete
current = state.parents.get(current);
[8710] Fix | Delete
}
[8711] Fix | Delete
} while (current !== undefined);
[8712] Fix | Delete
}
[8713] Fix | Delete
[8714] Fix | Delete
// To make sure the order of assignments doesn't matter,
[8715] Fix | Delete
// we first create empty objects and mutates the inner blocks later.
[8716] Fix | Delete
for (const clientId of uncontrolledParents) {
[8717] Fix | Delete
treeToUpdate.set(clientId, {
[8718] Fix | Delete
...treeToUpdate.get(clientId)
[8719] Fix | Delete
});
[8720] Fix | Delete
}
[8721] Fix | Delete
for (const clientId of uncontrolledParents) {
[8722] Fix | Delete
treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId));
[8723] Fix | Delete
}
[8724] Fix | Delete
[8725] Fix | Delete
// Controlled parent blocks, need a dedicated key for their inner blocks
[8726] Fix | Delete
// to be used when doing getBlocks( controlledBlockClientId ).
[8727] Fix | Delete
for (const clientId of controlledParents) {
[8728] Fix | Delete
treeToUpdate.set('controlled||' + clientId, {
[8729] Fix | Delete
innerBlocks: (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId))
[8730] Fix | Delete
});
[8731] Fix | Delete
}
[8732] Fix | Delete
}
[8733] Fix | Delete
[8734] Fix | Delete
/**
[8735] Fix | Delete
* Higher-order reducer intended to compute full block objects key for each block in the post.
[8736] Fix | Delete
* This is a denormalization to optimize the performance of the getBlock selectors and avoid
[8737] Fix | Delete
* recomputing the block objects and avoid heavy memoization.
[8738] Fix | Delete
*
[8739] Fix | Delete
* @param {Function} reducer Original reducer function.
[8740] Fix | Delete
*
[8741] Fix | Delete
* @return {Function} Enhanced reducer function.
[8742] Fix | Delete
*/
[8743] Fix | Delete
const withBlockTree = reducer => (state = {}, action) => {
[8744] Fix | Delete
const newState = reducer(state, action);
[8745] Fix | Delete
if (newState === state) {
[8746] Fix | Delete
return state;
[8747] Fix | Delete
}
[8748] Fix | Delete
newState.tree = state.tree ? state.tree : new Map();
[8749] Fix | Delete
switch (action.type) {
[8750] Fix | Delete
case 'RECEIVE_BLOCKS':
[8751] Fix | Delete
case 'INSERT_BLOCKS':
[8752] Fix | Delete
{
[8753] Fix | Delete
newState.tree = new Map(newState.tree);
[8754] Fix | Delete
updateBlockTreeForBlocks(newState, action.blocks);
[8755] Fix | Delete
updateParentInnerBlocksInTree(newState, action.rootClientId ? [action.rootClientId] : [''], true);
[8756] Fix | Delete
break;
[8757] Fix | Delete
}
[8758] Fix | Delete
case 'UPDATE_BLOCK':
[8759] Fix | Delete
newState.tree = new Map(newState.tree);
[8760] Fix | Delete
newState.tree.set(action.clientId, {
[8761] Fix | Delete
...newState.tree.get(action.clientId),
[8762] Fix | Delete
...newState.byClientId.get(action.clientId),
[8763] Fix | Delete
attributes: newState.attributes.get(action.clientId)
[8764] Fix | Delete
});
[8765] Fix | Delete
updateParentInnerBlocksInTree(newState, [action.clientId], false);
[8766] Fix | Delete
break;
[8767] Fix | Delete
case 'SYNC_DERIVED_BLOCK_ATTRIBUTES':
[8768] Fix | Delete
case 'UPDATE_BLOCK_ATTRIBUTES':
[8769] Fix | Delete
{
[8770] Fix | Delete
newState.tree = new Map(newState.tree);
[8771] Fix | Delete
action.clientIds.forEach(clientId => {
[8772] Fix | Delete
newState.tree.set(clientId, {
[8773] Fix | Delete
...newState.tree.get(clientId),
[8774] Fix | Delete
attributes: newState.attributes.get(clientId)
[8775] Fix | Delete
});
[8776] Fix | Delete
});
[8777] Fix | Delete
updateParentInnerBlocksInTree(newState, action.clientIds, false);
[8778] Fix | Delete
break;
[8779] Fix | Delete
}
[8780] Fix | Delete
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
[8781] Fix | Delete
{
[8782] Fix | Delete
const inserterClientIds = getFlattenedClientIds(action.blocks);
[8783] Fix | Delete
newState.tree = new Map(newState.tree);
[8784] Fix | Delete
action.replacedClientIds.forEach(clientId => {
[8785] Fix | Delete
newState.tree.delete(clientId);
[8786] Fix | Delete
// Controlled inner blocks are only removed
[8787] Fix | Delete
// if the block doesn't move to another position
[8788] Fix | Delete
// otherwise their content will be lost.
[8789] Fix | Delete
if (!inserterClientIds[clientId]) {
[8790] Fix | Delete
newState.tree.delete('controlled||' + clientId);
[8791] Fix | Delete
}
[8792] Fix | Delete
});
[8793] Fix | Delete
updateBlockTreeForBlocks(newState, action.blocks);
[8794] Fix | Delete
updateParentInnerBlocksInTree(newState, action.blocks.map(b => b.clientId), false);
[8795] Fix | Delete
[8796] Fix | Delete
// If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
[8797] Fix | Delete
const parentsOfRemovedBlocks = [];
[8798] Fix | Delete
for (const clientId of action.clientIds) {
[8799] Fix | Delete
const parentId = state.parents.get(clientId);
[8800] Fix | Delete
if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) {
[8801] Fix | Delete
parentsOfRemovedBlocks.push(parentId);
[8802] Fix | Delete
}
[8803] Fix | Delete
}
[8804] Fix | Delete
updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
[8805] Fix | Delete
break;
[8806] Fix | Delete
}
[8807] Fix | Delete
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
[8808] Fix | Delete
const parentsOfRemovedBlocks = [];
[8809] Fix | Delete
for (const clientId of action.clientIds) {
[8810] Fix | Delete
const parentId = state.parents.get(clientId);
[8811] Fix | Delete
if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) {
[8812] Fix | Delete
parentsOfRemovedBlocks.push(parentId);
[8813] Fix | Delete
}
[8814] Fix | Delete
}
[8815] Fix | Delete
newState.tree = new Map(newState.tree);
[8816] Fix | Delete
action.removedClientIds.forEach(clientId => {
[8817] Fix | Delete
newState.tree.delete(clientId);
[8818] Fix | Delete
newState.tree.delete('controlled||' + clientId);
[8819] Fix | Delete
});
[8820] Fix | Delete
updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
[8821] Fix | Delete
break;
[8822] Fix | Delete
case 'MOVE_BLOCKS_TO_POSITION':
[8823] Fix | Delete
{
[8824] Fix | Delete
const updatedBlockUids = [];
[8825] Fix | Delete
if (action.fromRootClientId) {
[8826] Fix | Delete
updatedBlockUids.push(action.fromRootClientId);
[8827] Fix | Delete
} else {
[8828] Fix | Delete
updatedBlockUids.push('');
[8829] Fix | Delete
}
[8830] Fix | Delete
if (action.toRootClientId) {
[8831] Fix | Delete
updatedBlockUids.push(action.toRootClientId);
[8832] Fix | Delete
}
[8833] Fix | Delete
newState.tree = new Map(newState.tree);
[8834] Fix | Delete
updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
[8835] Fix | Delete
break;
[8836] Fix | Delete
}
[8837] Fix | Delete
case 'MOVE_BLOCKS_UP':
[8838] Fix | Delete
case 'MOVE_BLOCKS_DOWN':
[8839] Fix | Delete
{
[8840] Fix | Delete
const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
[8841] Fix | Delete
newState.tree = new Map(newState.tree);
[8842] Fix | Delete
updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
[8843] Fix | Delete
break;
[8844] Fix | Delete
}
[8845] Fix | Delete
case 'SAVE_REUSABLE_BLOCK_SUCCESS':
[8846] Fix | Delete
{
[8847] Fix | Delete
const updatedBlockUids = [];
[8848] Fix | Delete
newState.attributes.forEach((attributes, clientId) => {
[8849] Fix | Delete
if (newState.byClientId.get(clientId).name === 'core/block' && attributes.ref === action.updatedId) {
[8850] Fix | Delete
updatedBlockUids.push(clientId);
[8851] Fix | Delete
}
[8852] Fix | Delete
});
[8853] Fix | Delete
newState.tree = new Map(newState.tree);
[8854] Fix | Delete
updatedBlockUids.forEach(clientId => {
[8855] Fix | Delete
newState.tree.set(clientId, {
[8856] Fix | Delete
...newState.byClientId.get(clientId),
[8857] Fix | Delete
attributes: newState.attributes.get(clientId),
[8858] Fix | Delete
innerBlocks: newState.tree.get(clientId).innerBlocks
[8859] Fix | Delete
});
[8860] Fix | Delete
});
[8861] Fix | Delete
updateParentInnerBlocksInTree(newState, updatedBlockUids, false);
[8862] Fix | Delete
}
[8863] Fix | Delete
}
[8864] Fix | Delete
return newState;
[8865] Fix | Delete
};
[8866] Fix | Delete
[8867] Fix | Delete
/**
[8868] Fix | Delete
* Higher-order reducer intended to augment the blocks reducer, assigning an
[8869] Fix | Delete
* `isPersistentChange` property value corresponding to whether a change in
[8870] Fix | Delete
* state can be considered as persistent. All changes are considered persistent
[8871] Fix | Delete
* except when updating the same block attribute as in the previous action.
[8872] Fix | Delete
*
[8873] Fix | Delete
* @param {Function} reducer Original reducer function.
[8874] Fix | Delete
*
[8875] Fix | Delete
* @return {Function} Enhanced reducer function.
[8876] Fix | Delete
*/
[8877] Fix | Delete
function withPersistentBlockChange(reducer) {
[8878] Fix | Delete
let lastAction;
[8879] Fix | Delete
let markNextChangeAsNotPersistent = false;
[8880] Fix | Delete
let explicitPersistent;
[8881] Fix | Delete
return (state, action) => {
[8882] Fix | Delete
let nextState = reducer(state, action);
[8883] Fix | Delete
let nextIsPersistentChange;
[8884] Fix | Delete
if (action.type === 'SET_EXPLICIT_PERSISTENT') {
[8885] Fix | Delete
var _state$isPersistentCh;
[8886] Fix | Delete
explicitPersistent = action.isPersistentChange;
[8887] Fix | Delete
nextIsPersistentChange = (_state$isPersistentCh = state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true;
[8888] Fix | Delete
}
[8889] Fix | Delete
if (explicitPersistent !== undefined) {
[8890] Fix | Delete
nextIsPersistentChange = explicitPersistent;
[8891] Fix | Delete
return nextIsPersistentChange === nextState.isPersistentChange ? nextState : {
[8892] Fix | Delete
...nextState,
[8893] Fix | Delete
isPersistentChange: nextIsPersistentChange
[8894] Fix | Delete
};
[8895] Fix | Delete
}
[8896] Fix | Delete
const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent;
[8897] Fix | Delete
[8898] Fix | Delete
// Defer to previous state value (or default) unless changing or
[8899] Fix | Delete
// explicitly marking as persistent.
[8900] Fix | Delete
if (state === nextState && !isExplicitPersistentChange) {
[8901] Fix | Delete
var _state$isPersistentCh2;
[8902] Fix | Delete
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
[8903] Fix | Delete
nextIsPersistentChange = (_state$isPersistentCh2 = state?.isPersistentChange) !== null && _state$isPersistentCh2 !== void 0 ? _state$isPersistentCh2 : true;
[8904] Fix | Delete
if (state.isPersistentChange === nextIsPersistentChange) {
[8905] Fix | Delete
return state;
[8906] Fix | Delete
}
[8907] Fix | Delete
return {
[8908] Fix | Delete
...nextState,
[8909] Fix | Delete
isPersistentChange: nextIsPersistentChange
[8910] Fix | Delete
};
[8911] Fix | Delete
}
[8912] Fix | Delete
nextState = {
[8913] Fix | Delete
...nextState,
[8914] Fix | Delete
isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
[8915] Fix | Delete
};
[8916] Fix | Delete
[8917] Fix | Delete
// In comparing against the previous action, consider only those which
[8918] Fix | Delete
// would have qualified as one which would have been ignored or not
[8919] Fix | Delete
// have resulted in a changed state.
[8920] Fix | Delete
lastAction = action;
[8921] Fix | Delete
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
[8922] Fix | Delete
return nextState;
[8923] Fix | Delete
};
[8924] Fix | Delete
}
[8925] Fix | Delete
[8926] Fix | Delete
/**
[8927] Fix | Delete
* Higher-order reducer intended to augment the blocks reducer, assigning an
[8928] Fix | Delete
* `isIgnoredChange` property value corresponding to whether a change in state
[8929] Fix | Delete
* can be considered as ignored. A change is considered ignored when the result
[8930] Fix | Delete
* of an action not incurred by direct user interaction.
[8931] Fix | Delete
*
[8932] Fix | Delete
* @param {Function} reducer Original reducer function.
[8933] Fix | Delete
*
[8934] Fix | Delete
* @return {Function} Enhanced reducer function.
[8935] Fix | Delete
*/
[8936] Fix | Delete
function withIgnoredBlockChange(reducer) {
[8937] Fix | Delete
/**
[8938] Fix | Delete
* Set of action types for which a blocks state change should be ignored.
[8939] Fix | Delete
*
[8940] Fix | Delete
* @type {Set}
[8941] Fix | Delete
*/
[8942] Fix | Delete
const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']);
[8943] Fix | Delete
return (state, action) => {
[8944] Fix | Delete
const nextState = reducer(state, action);
[8945] Fix | Delete
if (nextState !== state) {
[8946] Fix | Delete
nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
[8947] Fix | Delete
}
[8948] Fix | Delete
return nextState;
[8949] Fix | Delete
};
[8950] Fix | Delete
}
[8951] Fix | Delete
[8952] Fix | Delete
/**
[8953] Fix | Delete
* Higher-order reducer targeting the combined blocks reducer, augmenting
[8954] Fix | Delete
* block client IDs in remove action to include cascade of inner blocks.
[8955] Fix | Delete
*
[8956] Fix | Delete
* @param {Function} reducer Original reducer function.
[8957] Fix | Delete
*
[8958] Fix | Delete
* @return {Function} Enhanced reducer function.
[8959] Fix | Delete
*/
[8960] Fix | Delete
const withInnerBlocksRemoveCascade = reducer => (state, action) => {
[8961] Fix | Delete
// Gets all children which need to be removed.
[8962] Fix | Delete
const getAllChildren = clientIds => {
[8963] Fix | Delete
let result = clientIds;
[8964] Fix | Delete
for (let i = 0; i < result.length; i++) {
[8965] Fix | Delete
if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
[8966] Fix | Delete
continue;
[8967] Fix | Delete
}
[8968] Fix | Delete
if (result === clientIds) {
[8969] Fix | Delete
result = [...result];
[8970] Fix | Delete
}
[8971] Fix | Delete
result.push(...state.order.get(result[i]));
[8972] Fix | Delete
}
[8973] Fix | Delete
return result;
[8974] Fix | Delete
};
[8975] Fix | Delete
if (state) {
[8976] Fix | Delete
switch (action.type) {
[8977] Fix | Delete
case 'REMOVE_BLOCKS':
[8978] Fix | Delete
action = {
[8979] Fix | Delete
...action,
[8980] Fix | Delete
type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN',
[8981] Fix | Delete
removedClientIds: getAllChildren(action.clientIds)
[8982] Fix | Delete
};
[8983] Fix | Delete
break;
[8984] Fix | Delete
case 'REPLACE_BLOCKS':
[8985] Fix | Delete
action = {
[8986] Fix | Delete
...action,
[8987] Fix | Delete
type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN',
[8988] Fix | Delete
replacedClientIds: getAllChildren(action.clientIds)
[8989] Fix | Delete
};
[8990] Fix | Delete
break;
[8991] Fix | Delete
}
[8992] Fix | Delete
}
[8993] Fix | Delete
return reducer(state, action);
[8994] Fix | Delete
};
[8995] Fix | Delete
[8996] Fix | Delete
/**
[8997] Fix | Delete
* Higher-order reducer which targets the combined blocks reducer and handles
[8998] Fix | Delete
* the `RESET_BLOCKS` action. When dispatched, this action will replace all
[8999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function