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
isSelected
[40500] Fix | Delete
})]);
[40501] Fix | Delete
const blockEditContext = useBlockEditContext();
[40502] Fix | Delete
const hasBlockBindings = !!blockEditContext[blockBindingsKey];
[40503] Fix | Delete
const bindingsStyle = hasBlockBindings && canBindBlock(name) ? {
[40504] Fix | Delete
'--wp-admin-theme-color': 'var(--wp-block-synced-color)',
[40505] Fix | Delete
'--wp-admin-theme-color--rgb': 'var(--wp-block-synced-color--rgb)'
[40506] Fix | Delete
} : {};
[40507] Fix | Delete
[40508] Fix | Delete
// Ensures it warns only inside the `edit` implementation for the block.
[40509] Fix | Delete
if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
[40510] Fix | Delete
true ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : 0;
[40511] Fix | Delete
}
[40512] Fix | Delete
let hasNegativeMargin = false;
[40513] Fix | Delete
if (wrapperProps?.style?.marginTop?.charAt(0) === '-' || wrapperProps?.style?.marginBottom?.charAt(0) === '-' || wrapperProps?.style?.marginLeft?.charAt(0) === '-' || wrapperProps?.style?.marginRight?.charAt(0) === '-') {
[40514] Fix | Delete
hasNegativeMargin = true;
[40515] Fix | Delete
}
[40516] Fix | Delete
return {
[40517] Fix | Delete
tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
[40518] Fix | Delete
...wrapperProps,
[40519] Fix | Delete
...props,
[40520] Fix | Delete
ref: mergedRefs,
[40521] Fix | Delete
id: `block-${clientId}${htmlSuffix}`,
[40522] Fix | Delete
role: 'document',
[40523] Fix | Delete
'aria-label': blockLabel,
[40524] Fix | Delete
'data-block': clientId,
[40525] Fix | Delete
'data-type': name,
[40526] Fix | Delete
'data-title': blockTitle,
[40527] Fix | Delete
inert: isSubtreeDisabled ? 'true' : undefined,
[40528] Fix | Delete
className: dist_clsx('block-editor-block-list__block', {
[40529] Fix | Delete
// The wp-block className is important for editor styles.
[40530] Fix | Delete
'wp-block': !isAligned,
[40531] Fix | Delete
'has-block-overlay': hasOverlay,
[40532] Fix | Delete
'is-selected': isSelected,
[40533] Fix | Delete
'is-highlighted': isHighlighted,
[40534] Fix | Delete
'is-multi-selected': isMultiSelected,
[40535] Fix | Delete
'is-partially-selected': isPartiallySelected,
[40536] Fix | Delete
'is-reusable': isReusable,
[40537] Fix | Delete
'is-dragging': isDragging,
[40538] Fix | Delete
'has-child-selected': hasChildSelected,
[40539] Fix | Delete
'is-block-moving-mode': isBlockMovingMode,
[40540] Fix | Delete
'can-insert-moving-block': canInsertMovingBlock,
[40541] Fix | Delete
'is-editing-disabled': isEditingDisabled,
[40542] Fix | Delete
'has-editable-outline': hasEditableOutline,
[40543] Fix | Delete
'has-negative-margin': hasNegativeMargin,
[40544] Fix | Delete
'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
[40545] Fix | Delete
}, className, props.className, wrapperProps.className, defaultClassName),
[40546] Fix | Delete
style: {
[40547] Fix | Delete
...wrapperProps.style,
[40548] Fix | Delete
...props.style,
[40549] Fix | Delete
...bindingsStyle
[40550] Fix | Delete
}
[40551] Fix | Delete
};
[40552] Fix | Delete
}
[40553] Fix | Delete
[40554] Fix | Delete
/**
[40555] Fix | Delete
* Call within a save function to get the props for the block wrapper.
[40556] Fix | Delete
*
[40557] Fix | Delete
* @param {Object} props Optional. Props to pass to the element.
[40558] Fix | Delete
*/
[40559] Fix | Delete
use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
[40560] Fix | Delete
[40561] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js
[40562] Fix | Delete
/**
[40563] Fix | Delete
* External dependencies
[40564] Fix | Delete
*/
[40565] Fix | Delete
[40566] Fix | Delete
[40567] Fix | Delete
/**
[40568] Fix | Delete
* WordPress dependencies
[40569] Fix | Delete
*/
[40570] Fix | Delete
[40571] Fix | Delete
[40572] Fix | Delete
[40573] Fix | Delete
[40574] Fix | Delete
[40575] Fix | Delete
[40576] Fix | Delete
[40577] Fix | Delete
/**
[40578] Fix | Delete
* Internal dependencies
[40579] Fix | Delete
*/
[40580] Fix | Delete
[40581] Fix | Delete
[40582] Fix | Delete
[40583] Fix | Delete
[40584] Fix | Delete
[40585] Fix | Delete
[40586] Fix | Delete
[40587] Fix | Delete
[40588] Fix | Delete
[40589] Fix | Delete
[40590] Fix | Delete
[40591] Fix | Delete
/**
[40592] Fix | Delete
* Merges wrapper props with special handling for classNames and styles.
[40593] Fix | Delete
*
[40594] Fix | Delete
* @param {Object} propsA
[40595] Fix | Delete
* @param {Object} propsB
[40596] Fix | Delete
*
[40597] Fix | Delete
* @return {Object} Merged props.
[40598] Fix | Delete
*/
[40599] Fix | Delete
[40600] Fix | Delete
[40601] Fix | Delete
[40602] Fix | Delete
function mergeWrapperProps(propsA, propsB) {
[40603] Fix | Delete
const newProps = {
[40604] Fix | Delete
...propsA,
[40605] Fix | Delete
...propsB
[40606] Fix | Delete
};
[40607] Fix | Delete
[40608] Fix | Delete
// May be set to undefined, so check if the property is set!
[40609] Fix | Delete
if (propsA?.hasOwnProperty('className') && propsB?.hasOwnProperty('className')) {
[40610] Fix | Delete
newProps.className = dist_clsx(propsA.className, propsB.className);
[40611] Fix | Delete
}
[40612] Fix | Delete
if (propsA?.hasOwnProperty('style') && propsB?.hasOwnProperty('style')) {
[40613] Fix | Delete
newProps.style = {
[40614] Fix | Delete
...propsA.style,
[40615] Fix | Delete
...propsB.style
[40616] Fix | Delete
};
[40617] Fix | Delete
}
[40618] Fix | Delete
return newProps;
[40619] Fix | Delete
}
[40620] Fix | Delete
function Block({
[40621] Fix | Delete
children,
[40622] Fix | Delete
isHtml,
[40623] Fix | Delete
...props
[40624] Fix | Delete
}) {
[40625] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[40626] Fix | Delete
...use_block_props_useBlockProps(props, {
[40627] Fix | Delete
__unstableIsHtml: isHtml
[40628] Fix | Delete
}),
[40629] Fix | Delete
children: children
[40630] Fix | Delete
});
[40631] Fix | Delete
}
[40632] Fix | Delete
function BlockListBlock({
[40633] Fix | Delete
block: {
[40634] Fix | Delete
__unstableBlockSource
[40635] Fix | Delete
},
[40636] Fix | Delete
mode,
[40637] Fix | Delete
isLocked,
[40638] Fix | Delete
canRemove,
[40639] Fix | Delete
clientId,
[40640] Fix | Delete
isSelected,
[40641] Fix | Delete
isSelectionEnabled,
[40642] Fix | Delete
className,
[40643] Fix | Delete
__unstableLayoutClassNames: layoutClassNames,
[40644] Fix | Delete
name,
[40645] Fix | Delete
isValid,
[40646] Fix | Delete
attributes,
[40647] Fix | Delete
wrapperProps,
[40648] Fix | Delete
setAttributes,
[40649] Fix | Delete
onReplace,
[40650] Fix | Delete
onInsertBlocksAfter,
[40651] Fix | Delete
onMerge,
[40652] Fix | Delete
toggleSelection
[40653] Fix | Delete
}) {
[40654] Fix | Delete
var _wrapperProps;
[40655] Fix | Delete
const {
[40656] Fix | Delete
mayDisplayControls,
[40657] Fix | Delete
mayDisplayParentControls,
[40658] Fix | Delete
themeSupportsLayout,
[40659] Fix | Delete
...context
[40660] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
[40661] Fix | Delete
const {
[40662] Fix | Delete
removeBlock
[40663] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[40664] Fix | Delete
const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId, removeBlock]);
[40665] Fix | Delete
const parentLayout = useLayout() || {};
[40666] Fix | Delete
[40667] Fix | Delete
// We wrap the BlockEdit component in a div that hides it when editing in
[40668] Fix | Delete
// HTML mode. This allows us to render all of the ancillary pieces
[40669] Fix | Delete
// (InspectorControls, etc.) which are inside `BlockEdit` but not
[40670] Fix | Delete
// `BlockHTML`, even in HTML mode.
[40671] Fix | Delete
let blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
[40672] Fix | Delete
name: name,
[40673] Fix | Delete
isSelected: isSelected,
[40674] Fix | Delete
attributes: attributes,
[40675] Fix | Delete
setAttributes: setAttributes,
[40676] Fix | Delete
insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter,
[40677] Fix | Delete
onReplace: canRemove ? onReplace : undefined,
[40678] Fix | Delete
onRemove: canRemove ? onRemove : undefined,
[40679] Fix | Delete
mergeBlocks: canRemove ? onMerge : undefined,
[40680] Fix | Delete
clientId: clientId,
[40681] Fix | Delete
isSelectionEnabled: isSelectionEnabled,
[40682] Fix | Delete
toggleSelection: toggleSelection,
[40683] Fix | Delete
__unstableLayoutClassNames: layoutClassNames,
[40684] Fix | Delete
__unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : undefined,
[40685] Fix | Delete
mayDisplayControls: mayDisplayControls,
[40686] Fix | Delete
mayDisplayParentControls: mayDisplayParentControls,
[40687] Fix | Delete
blockEditingMode: context.blockEditingMode,
[40688] Fix | Delete
isPreviewMode: context.isPreviewMode
[40689] Fix | Delete
});
[40690] Fix | Delete
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
[40691] Fix | Delete
[40692] Fix | Delete
// Determine whether the block has props to apply to the wrapper.
[40693] Fix | Delete
if (blockType?.getEditWrapperProps) {
[40694] Fix | Delete
wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes));
[40695] Fix | Delete
}
[40696] Fix | Delete
const isAligned = wrapperProps && !!wrapperProps['data-align'] && !themeSupportsLayout;
[40697] Fix | Delete
[40698] Fix | Delete
// Support for sticky position in classic themes with alignment wrappers.
[40699] Fix | Delete
[40700] Fix | Delete
const isSticky = className?.includes('is-position-sticky');
[40701] Fix | Delete
[40702] Fix | Delete
// For aligned blocks, provide a wrapper element so the block can be
[40703] Fix | Delete
// positioned relative to the block column.
[40704] Fix | Delete
// This is only kept for classic themes that don't support layout
[40705] Fix | Delete
// Historically we used to rely on extra divs and data-align to
[40706] Fix | Delete
// provide the alignments styles in the editor.
[40707] Fix | Delete
// Due to the differences between frontend and backend, we migrated
[40708] Fix | Delete
// to the layout feature, and we're now aligning the markup of frontend
[40709] Fix | Delete
// and backend.
[40710] Fix | Delete
if (isAligned) {
[40711] Fix | Delete
blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[40712] Fix | Delete
className: dist_clsx('wp-block', isSticky && className),
[40713] Fix | Delete
"data-align": wrapperProps['data-align'],
[40714] Fix | Delete
children: blockEdit
[40715] Fix | Delete
});
[40716] Fix | Delete
}
[40717] Fix | Delete
let block;
[40718] Fix | Delete
if (!isValid) {
[40719] Fix | Delete
const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
[40720] Fix | Delete
block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, {
[40721] Fix | Delete
className: "has-warning",
[40722] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, {
[40723] Fix | Delete
clientId: clientId
[40724] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, {
[40725] Fix | Delete
children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent)
[40726] Fix | Delete
})]
[40727] Fix | Delete
});
[40728] Fix | Delete
} else if (mode === 'html') {
[40729] Fix | Delete
// Render blockEdit so the inspector controls don't disappear.
[40730] Fix | Delete
// See #8969.
[40731] Fix | Delete
block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[40732] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[40733] Fix | Delete
style: {
[40734] Fix | Delete
display: 'none'
[40735] Fix | Delete
},
[40736] Fix | Delete
children: blockEdit
[40737] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, {
[40738] Fix | Delete
isHtml: true,
[40739] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html, {
[40740] Fix | Delete
clientId: clientId
[40741] Fix | Delete
})
[40742] Fix | Delete
})]
[40743] Fix | Delete
});
[40744] Fix | Delete
} else if (blockType?.apiVersion > 1) {
[40745] Fix | Delete
block = blockEdit;
[40746] Fix | Delete
} else {
[40747] Fix | Delete
block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, {
[40748] Fix | Delete
children: blockEdit
[40749] Fix | Delete
});
[40750] Fix | Delete
}
[40751] Fix | Delete
const {
[40752] Fix | Delete
'data-align': dataAlign,
[40753] Fix | Delete
...restWrapperProps
[40754] Fix | Delete
} = (_wrapperProps = wrapperProps) !== null && _wrapperProps !== void 0 ? _wrapperProps : {};
[40755] Fix | Delete
const updatedWrapperProps = {
[40756] Fix | Delete
...restWrapperProps,
[40757] Fix | Delete
className: dist_clsx(restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className)
[40758] Fix | Delete
};
[40759] Fix | Delete
[40760] Fix | Delete
// We set a new context with the adjusted and filtered wrapperProps (through
[40761] Fix | Delete
// `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have
[40762] Fix | Delete
// access to.
[40763] Fix | Delete
// Note that the context value doesn't have to be memoized in this case
[40764] Fix | Delete
// because when it changes, this component will be re-rendered anyway, and
[40765] Fix | Delete
// none of the consumers (BlockListBlock and useBlockProps) are memoized or
[40766] Fix | Delete
// "pure". This is different from the public BlockEditContext, where
[40767] Fix | Delete
// consumers might be memoized or "pure".
[40768] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, {
[40769] Fix | Delete
value: {
[40770] Fix | Delete
wrapperProps: updatedWrapperProps,
[40771] Fix | Delete
isAligned,
[40772] Fix | Delete
...context
[40773] Fix | Delete
},
[40774] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_boundary, {
[40775] Fix | Delete
fallback: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, {
[40776] Fix | Delete
className: "has-warning",
[40777] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning, {})
[40778] Fix | Delete
}),
[40779] Fix | Delete
children: block
[40780] Fix | Delete
})
[40781] Fix | Delete
});
[40782] Fix | Delete
}
[40783] Fix | Delete
const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => {
[40784] Fix | Delete
const {
[40785] Fix | Delete
updateBlockAttributes,
[40786] Fix | Delete
insertBlocks,
[40787] Fix | Delete
mergeBlocks,
[40788] Fix | Delete
replaceBlocks,
[40789] Fix | Delete
toggleSelection,
[40790] Fix | Delete
__unstableMarkLastChangeAsPersistent,
[40791] Fix | Delete
moveBlocksToPosition,
[40792] Fix | Delete
removeBlock,
[40793] Fix | Delete
selectBlock
[40794] Fix | Delete
} = dispatch(store);
[40795] Fix | Delete
[40796] Fix | Delete
// Do not add new properties here, use `useDispatch` instead to avoid
[40797] Fix | Delete
// leaking new props to the public API (editor.BlockListBlock filter).
[40798] Fix | Delete
return {
[40799] Fix | Delete
setAttributes(newAttributes) {
[40800] Fix | Delete
const {
[40801] Fix | Delete
getMultiSelectedBlockClientIds
[40802] Fix | Delete
} = registry.select(store);
[40803] Fix | Delete
const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds();
[40804] Fix | Delete
const {
[40805] Fix | Delete
clientId
[40806] Fix | Delete
} = ownProps;
[40807] Fix | Delete
const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId];
[40808] Fix | Delete
updateBlockAttributes(clientIds, newAttributes);
[40809] Fix | Delete
},
[40810] Fix | Delete
onInsertBlocks(blocks, index) {
[40811] Fix | Delete
const {
[40812] Fix | Delete
rootClientId
[40813] Fix | Delete
} = ownProps;
[40814] Fix | Delete
insertBlocks(blocks, index, rootClientId);
[40815] Fix | Delete
},
[40816] Fix | Delete
onInsertBlocksAfter(blocks) {
[40817] Fix | Delete
const {
[40818] Fix | Delete
clientId,
[40819] Fix | Delete
rootClientId
[40820] Fix | Delete
} = ownProps;
[40821] Fix | Delete
const {
[40822] Fix | Delete
getBlockIndex
[40823] Fix | Delete
} = registry.select(store);
[40824] Fix | Delete
const index = getBlockIndex(clientId);
[40825] Fix | Delete
insertBlocks(blocks, index + 1, rootClientId);
[40826] Fix | Delete
},
[40827] Fix | Delete
onMerge(forward) {
[40828] Fix | Delete
const {
[40829] Fix | Delete
clientId,
[40830] Fix | Delete
rootClientId
[40831] Fix | Delete
} = ownProps;
[40832] Fix | Delete
const {
[40833] Fix | Delete
getPreviousBlockClientId,
[40834] Fix | Delete
getNextBlockClientId,
[40835] Fix | Delete
getBlock,
[40836] Fix | Delete
getBlockAttributes,
[40837] Fix | Delete
getBlockName,
[40838] Fix | Delete
getBlockOrder,
[40839] Fix | Delete
getBlockIndex,
[40840] Fix | Delete
getBlockRootClientId,
[40841] Fix | Delete
canInsertBlockType
[40842] Fix | Delete
} = registry.select(store);
[40843] Fix | Delete
function switchToDefaultOrRemove() {
[40844] Fix | Delete
const block = getBlock(clientId);
[40845] Fix | Delete
const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
[40846] Fix | Delete
if (getBlockName(clientId) !== defaultBlockName) {
[40847] Fix | Delete
const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, defaultBlockName);
[40848] Fix | Delete
if (replacement && replacement.length) {
[40849] Fix | Delete
replaceBlocks(clientId, replacement);
[40850] Fix | Delete
}
[40851] Fix | Delete
} else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) {
[40852] Fix | Delete
const nextBlockClientId = getNextBlockClientId(clientId);
[40853] Fix | Delete
if (nextBlockClientId) {
[40854] Fix | Delete
registry.batch(() => {
[40855] Fix | Delete
removeBlock(clientId);
[40856] Fix | Delete
selectBlock(nextBlockClientId);
[40857] Fix | Delete
});
[40858] Fix | Delete
}
[40859] Fix | Delete
}
[40860] Fix | Delete
}
[40861] Fix | Delete
[40862] Fix | Delete
/**
[40863] Fix | Delete
* Moves the block with clientId up one level. If the block type
[40864] Fix | Delete
* cannot be inserted at the new location, it will be attempted to
[40865] Fix | Delete
* convert to the default block type.
[40866] Fix | Delete
*
[40867] Fix | Delete
* @param {string} _clientId The block to move.
[40868] Fix | Delete
* @param {boolean} changeSelection Whether to change the selection
[40869] Fix | Delete
* to the moved block.
[40870] Fix | Delete
*/
[40871] Fix | Delete
function moveFirstItemUp(_clientId, changeSelection = true) {
[40872] Fix | Delete
const targetRootClientId = getBlockRootClientId(_clientId);
[40873] Fix | Delete
const blockOrder = getBlockOrder(_clientId);
[40874] Fix | Delete
const [firstClientId] = blockOrder;
[40875] Fix | Delete
if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) {
[40876] Fix | Delete
removeBlock(_clientId);
[40877] Fix | Delete
} else {
[40878] Fix | Delete
registry.batch(() => {
[40879] Fix | Delete
if (canInsertBlockType(getBlockName(firstClientId), targetRootClientId)) {
[40880] Fix | Delete
moveBlocksToPosition([firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId));
[40881] Fix | Delete
} else {
[40882] Fix | Delete
const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(firstClientId), (0,external_wp_blocks_namespaceObject.getDefaultBlockName)());
[40883] Fix | Delete
if (replacement && replacement.length && replacement.every(block => canInsertBlockType(block.name, targetRootClientId))) {
[40884] Fix | Delete
insertBlocks(replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection);
[40885] Fix | Delete
removeBlock(firstClientId, false);
[40886] Fix | Delete
} else {
[40887] Fix | Delete
switchToDefaultOrRemove();
[40888] Fix | Delete
}
[40889] Fix | Delete
}
[40890] Fix | Delete
if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) {
[40891] Fix | Delete
removeBlock(_clientId, false);
[40892] Fix | Delete
}
[40893] Fix | Delete
});
[40894] Fix | Delete
}
[40895] Fix | Delete
}
[40896] Fix | Delete
[40897] Fix | Delete
// For `Delete` or forward merge, we should do the exact same thing
[40898] Fix | Delete
// as `Backspace`, but from the other block.
[40899] Fix | Delete
if (forward) {
[40900] Fix | Delete
if (rootClientId) {
[40901] Fix | Delete
const nextRootClientId = getNextBlockClientId(rootClientId);
[40902] Fix | Delete
if (nextRootClientId) {
[40903] Fix | Delete
// If there is a block that follows with the same parent
[40904] Fix | Delete
// block name and the same attributes, merge the inner
[40905] Fix | Delete
// blocks.
[40906] Fix | Delete
if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) {
[40907] Fix | Delete
const rootAttributes = getBlockAttributes(rootClientId);
[40908] Fix | Delete
const previousRootAttributes = getBlockAttributes(nextRootClientId);
[40909] Fix | Delete
if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
[40910] Fix | Delete
registry.batch(() => {
[40911] Fix | Delete
moveBlocksToPosition(getBlockOrder(nextRootClientId), nextRootClientId, rootClientId);
[40912] Fix | Delete
removeBlock(nextRootClientId, false);
[40913] Fix | Delete
});
[40914] Fix | Delete
return;
[40915] Fix | Delete
}
[40916] Fix | Delete
} else {
[40917] Fix | Delete
mergeBlocks(rootClientId, nextRootClientId);
[40918] Fix | Delete
return;
[40919] Fix | Delete
}
[40920] Fix | Delete
}
[40921] Fix | Delete
}
[40922] Fix | Delete
const nextBlockClientId = getNextBlockClientId(clientId);
[40923] Fix | Delete
if (!nextBlockClientId) {
[40924] Fix | Delete
return;
[40925] Fix | Delete
}
[40926] Fix | Delete
if (getBlockOrder(nextBlockClientId).length) {
[40927] Fix | Delete
moveFirstItemUp(nextBlockClientId, false);
[40928] Fix | Delete
} else {
[40929] Fix | Delete
mergeBlocks(clientId, nextBlockClientId);
[40930] Fix | Delete
}
[40931] Fix | Delete
} else {
[40932] Fix | Delete
const previousBlockClientId = getPreviousBlockClientId(clientId);
[40933] Fix | Delete
if (previousBlockClientId) {
[40934] Fix | Delete
mergeBlocks(previousBlockClientId, clientId);
[40935] Fix | Delete
} else if (rootClientId) {
[40936] Fix | Delete
const previousRootClientId = getPreviousBlockClientId(rootClientId);
[40937] Fix | Delete
[40938] Fix | Delete
// If there is a preceding block with the same parent block
[40939] Fix | Delete
// name and the same attributes, merge the inner blocks.
[40940] Fix | Delete
if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) {
[40941] Fix | Delete
const rootAttributes = getBlockAttributes(rootClientId);
[40942] Fix | Delete
const previousRootAttributes = getBlockAttributes(previousRootClientId);
[40943] Fix | Delete
if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
[40944] Fix | Delete
registry.batch(() => {
[40945] Fix | Delete
moveBlocksToPosition(getBlockOrder(rootClientId), rootClientId, previousRootClientId);
[40946] Fix | Delete
removeBlock(rootClientId, false);
[40947] Fix | Delete
});
[40948] Fix | Delete
return;
[40949] Fix | Delete
}
[40950] Fix | Delete
}
[40951] Fix | Delete
moveFirstItemUp(rootClientId);
[40952] Fix | Delete
} else {
[40953] Fix | Delete
switchToDefaultOrRemove();
[40954] Fix | Delete
}
[40955] Fix | Delete
}
[40956] Fix | Delete
},
[40957] Fix | Delete
onReplace(blocks, indexToSelect, initialPosition) {
[40958] Fix | Delete
if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) {
[40959] Fix | Delete
__unstableMarkLastChangeAsPersistent();
[40960] Fix | Delete
}
[40961] Fix | Delete
//Unsynced patterns are nested in an array so we need to flatten them.
[40962] Fix | Delete
const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks;
[40963] Fix | Delete
replaceBlocks([ownProps.clientId], replacementBlocks, indexToSelect, initialPosition);
[40964] Fix | Delete
},
[40965] Fix | Delete
toggleSelection(selectionEnabled) {
[40966] Fix | Delete
toggleSelection(selectionEnabled);
[40967] Fix | Delete
}
[40968] Fix | Delete
};
[40969] Fix | Delete
});
[40970] Fix | Delete
[40971] Fix | Delete
// This component is used by the BlockListBlockProvider component below. It will
[40972] Fix | Delete
// add the props necessary for the `editor.BlockListBlock` filters.
[40973] Fix | Delete
BlockListBlock = (0,external_wp_compose_namespaceObject.compose)(applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock);
[40974] Fix | Delete
[40975] Fix | Delete
// This component provides all the information we need through a single store
[40976] Fix | Delete
// subscription (useSelect mapping). Only the necessary props are passed down
[40977] Fix | Delete
// to the BlockListBlock component, which is a filtered component, so these
[40978] Fix | Delete
// props are public API. To avoid adding to the public API, we use a private
[40979] Fix | Delete
// context to pass the rest of the information to the filtered BlockListBlock
[40980] Fix | Delete
// component, and useBlockProps.
[40981] Fix | Delete
function BlockListBlockProvider(props) {
[40982] Fix | Delete
const {
[40983] Fix | Delete
clientId,
[40984] Fix | Delete
rootClientId
[40985] Fix | Delete
} = props;
[40986] Fix | Delete
const selectedProps = (0,external_wp_data_namespaceObject.useSelect)(select => {
[40987] Fix | Delete
const {
[40988] Fix | Delete
isBlockSelected,
[40989] Fix | Delete
getBlockMode,
[40990] Fix | Delete
isSelectionEnabled,
[40991] Fix | Delete
getTemplateLock,
[40992] Fix | Delete
getBlockWithoutAttributes,
[40993] Fix | Delete
getBlockAttributes,
[40994] Fix | Delete
canRemoveBlock,
[40995] Fix | Delete
canMoveBlock,
[40996] Fix | Delete
getSettings,
[40997] Fix | Delete
getTemporarilyEditingAsBlocks,
[40998] Fix | Delete
getBlockEditingMode,
[40999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function