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
exit: "start",
[49000] Fix | Delete
ref: ref,
[49001] Fix | Delete
tabIndex: -1,
[49002] Fix | Delete
onClick: onClick,
[49003] Fix | Delete
onFocus: onFocus,
[49004] Fix | Delete
className: dist_clsx(className, {
[49005] Fix | Delete
'is-with-inserter': isInserterShown
[49006] Fix | Delete
}),
[49007] Fix | Delete
onHoverEnd: maybeHideInserterPoint,
[49008] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
[49009] Fix | Delete
variants: lineVariants,
[49010] Fix | Delete
className: "block-editor-block-list__insertion-point-indicator",
[49011] Fix | Delete
"data-testid": "block-list-insertion-point-indicator"
[49012] Fix | Delete
}), isInserterShown && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
[49013] Fix | Delete
variants: inserterVariants,
[49014] Fix | Delete
className: dist_clsx('block-editor-block-list__insertion-point-inserter'),
[49015] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, {
[49016] Fix | Delete
position: "bottom center",
[49017] Fix | Delete
clientId: nextClientId,
[49018] Fix | Delete
rootClientId: rootClientId,
[49019] Fix | Delete
__experimentalIsQuick: true,
[49020] Fix | Delete
onToggle: isOpen => {
[49021] Fix | Delete
openRef.current = isOpen;
[49022] Fix | Delete
},
[49023] Fix | Delete
onSelectOrClose: () => {
[49024] Fix | Delete
openRef.current = false;
[49025] Fix | Delete
}
[49026] Fix | Delete
})
[49027] Fix | Delete
})]
[49028] Fix | Delete
})
[49029] Fix | Delete
});
[49030] Fix | Delete
}
[49031] Fix | Delete
function InsertionPoint(props) {
[49032] Fix | Delete
const {
[49033] Fix | Delete
insertionPoint,
[49034] Fix | Delete
isVisible,
[49035] Fix | Delete
isBlockListEmpty
[49036] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[49037] Fix | Delete
const {
[49038] Fix | Delete
getBlockInsertionPoint,
[49039] Fix | Delete
isBlockInsertionPointVisible,
[49040] Fix | Delete
getBlockCount
[49041] Fix | Delete
} = select(store);
[49042] Fix | Delete
const blockInsertionPoint = getBlockInsertionPoint();
[49043] Fix | Delete
return {
[49044] Fix | Delete
insertionPoint: blockInsertionPoint,
[49045] Fix | Delete
isVisible: isBlockInsertionPointVisible(),
[49046] Fix | Delete
isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0
[49047] Fix | Delete
};
[49048] Fix | Delete
}, []);
[49049] Fix | Delete
if (!isVisible ||
[49050] Fix | Delete
// Don't render the insertion point if the block list is empty.
[49051] Fix | Delete
// The insertion point will be represented by the appender instead.
[49052] Fix | Delete
isBlockListEmpty) {
[49053] Fix | Delete
return null;
[49054] Fix | Delete
}
[49055] Fix | Delete
[49056] Fix | Delete
/**
[49057] Fix | Delete
* Render a popover that overlays the block when the desired operation is to replace it.
[49058] Fix | Delete
* Otherwise, render a popover in between blocks for the indication of inserting between them.
[49059] Fix | Delete
*/
[49060] Fix | Delete
return insertionPoint.operation === 'replace' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(drop_zone
[49061] Fix | Delete
// Force remount to trigger the animation.
[49062] Fix | Delete
, {
[49063] Fix | Delete
...props
[49064] Fix | Delete
}, `${insertionPoint.rootClientId}-${insertionPoint.index}`) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InbetweenInsertionPointPopover, {
[49065] Fix | Delete
operation: insertionPoint.operation,
[49066] Fix | Delete
nearestSide: insertionPoint.nearestSide,
[49067] Fix | Delete
...props
[49068] Fix | Delete
});
[49069] Fix | Delete
}
[49070] Fix | Delete
[49071] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js
[49072] Fix | Delete
/**
[49073] Fix | Delete
* WordPress dependencies
[49074] Fix | Delete
*/
[49075] Fix | Delete
[49076] Fix | Delete
[49077] Fix | Delete
[49078] Fix | Delete
[49079] Fix | Delete
[49080] Fix | Delete
/**
[49081] Fix | Delete
* Internal dependencies
[49082] Fix | Delete
*/
[49083] Fix | Delete
[49084] Fix | Delete
[49085] Fix | Delete
function useInBetweenInserter() {
[49086] Fix | Delete
const openRef = (0,external_wp_element_namespaceObject.useContext)(insertion_point_InsertionPointOpenRef);
[49087] Fix | Delete
const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree || select(store).__unstableGetEditorMode() === 'zoom-out', []);
[49088] Fix | Delete
const {
[49089] Fix | Delete
getBlockListSettings,
[49090] Fix | Delete
getBlockIndex,
[49091] Fix | Delete
isMultiSelecting,
[49092] Fix | Delete
getSelectedBlockClientIds,
[49093] Fix | Delete
getTemplateLock,
[49094] Fix | Delete
__unstableIsWithinBlockOverlay,
[49095] Fix | Delete
getBlockEditingMode,
[49096] Fix | Delete
getBlockName
[49097] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[49098] Fix | Delete
const {
[49099] Fix | Delete
showInsertionPoint,
[49100] Fix | Delete
hideInsertionPoint
[49101] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[49102] Fix | Delete
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
[49103] Fix | Delete
if (isInBetweenInserterDisabled) {
[49104] Fix | Delete
return;
[49105] Fix | Delete
}
[49106] Fix | Delete
function onMouseMove(event) {
[49107] Fix | Delete
// openRef is the reference to the insertion point between blocks.
[49108] Fix | Delete
// If the reference is not set or the insertion point is already open, return.
[49109] Fix | Delete
if (openRef === undefined || openRef.current) {
[49110] Fix | Delete
return;
[49111] Fix | Delete
}
[49112] Fix | Delete
[49113] Fix | Delete
// Ignore text nodes sometimes detected in FireFox.
[49114] Fix | Delete
if (event.target.nodeType === event.target.TEXT_NODE) {
[49115] Fix | Delete
return;
[49116] Fix | Delete
}
[49117] Fix | Delete
if (isMultiSelecting()) {
[49118] Fix | Delete
return;
[49119] Fix | Delete
}
[49120] Fix | Delete
if (!event.target.classList.contains('block-editor-block-list__layout')) {
[49121] Fix | Delete
hideInsertionPoint();
[49122] Fix | Delete
return;
[49123] Fix | Delete
}
[49124] Fix | Delete
let rootClientId;
[49125] Fix | Delete
if (!event.target.classList.contains('is-root-container')) {
[49126] Fix | Delete
const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
[49127] Fix | Delete
rootClientId = blockElement.getAttribute('data-block');
[49128] Fix | Delete
}
[49129] Fix | Delete
if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block') {
[49130] Fix | Delete
return;
[49131] Fix | Delete
}
[49132] Fix | Delete
const orientation = getBlockListSettings(rootClientId)?.orientation || 'vertical';
[49133] Fix | Delete
const offsetTop = event.clientY;
[49134] Fix | Delete
const offsetLeft = event.clientX;
[49135] Fix | Delete
const children = Array.from(event.target.children);
[49136] Fix | Delete
let element = children.find(blockEl => {
[49137] Fix | Delete
const blockElRect = blockEl.getBoundingClientRect();
[49138] Fix | Delete
return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockElRect.top > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && ((0,external_wp_i18n_namespaceObject.isRTL)() ? blockElRect.right < offsetLeft : blockElRect.left > offsetLeft);
[49139] Fix | Delete
});
[49140] Fix | Delete
if (!element) {
[49141] Fix | Delete
hideInsertionPoint();
[49142] Fix | Delete
return;
[49143] Fix | Delete
}
[49144] Fix | Delete
[49145] Fix | Delete
// The block may be in an alignment wrapper, so check the first direct
[49146] Fix | Delete
// child if the element has no ID.
[49147] Fix | Delete
if (!element.id) {
[49148] Fix | Delete
element = element.firstElementChild;
[49149] Fix | Delete
if (!element) {
[49150] Fix | Delete
hideInsertionPoint();
[49151] Fix | Delete
return;
[49152] Fix | Delete
}
[49153] Fix | Delete
}
[49154] Fix | Delete
[49155] Fix | Delete
// Don't show the insertion point if a parent block has an "overlay"
[49156] Fix | Delete
// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
[49157] Fix | Delete
const clientId = element.id.slice('block-'.length);
[49158] Fix | Delete
if (!clientId || __unstableIsWithinBlockOverlay(clientId)) {
[49159] Fix | Delete
return;
[49160] Fix | Delete
}
[49161] Fix | Delete
[49162] Fix | Delete
// Don't show the inserter when hovering above (conflicts with
[49163] Fix | Delete
// block toolbar) or inside selected block(s).
[49164] Fix | Delete
if (getSelectedBlockClientIds().includes(clientId)) {
[49165] Fix | Delete
return;
[49166] Fix | Delete
}
[49167] Fix | Delete
const elementRect = element.getBoundingClientRect();
[49168] Fix | Delete
if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) {
[49169] Fix | Delete
hideInsertionPoint();
[49170] Fix | Delete
return;
[49171] Fix | Delete
}
[49172] Fix | Delete
const index = getBlockIndex(clientId);
[49173] Fix | Delete
[49174] Fix | Delete
// Don't show the in-between inserter before the first block in
[49175] Fix | Delete
// the list (preserves the original behaviour).
[49176] Fix | Delete
if (index === 0) {
[49177] Fix | Delete
hideInsertionPoint();
[49178] Fix | Delete
return;
[49179] Fix | Delete
}
[49180] Fix | Delete
showInsertionPoint(rootClientId, index, {
[49181] Fix | Delete
__unstableWithInserter: true
[49182] Fix | Delete
});
[49183] Fix | Delete
}
[49184] Fix | Delete
node.addEventListener('mousemove', onMouseMove);
[49185] Fix | Delete
return () => {
[49186] Fix | Delete
node.removeEventListener('mousemove', onMouseMove);
[49187] Fix | Delete
};
[49188] Fix | Delete
}, [openRef, getBlockListSettings, getBlockIndex, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds, isInBetweenInserterDisabled]);
[49189] Fix | Delete
}
[49190] Fix | Delete
[49191] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/with-client-id.js
[49192] Fix | Delete
/**
[49193] Fix | Delete
* WordPress dependencies
[49194] Fix | Delete
*/
[49195] Fix | Delete
[49196] Fix | Delete
[49197] Fix | Delete
/**
[49198] Fix | Delete
* Internal dependencies
[49199] Fix | Delete
*/
[49200] Fix | Delete
[49201] Fix | Delete
[49202] Fix | Delete
const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
[49203] Fix | Delete
const {
[49204] Fix | Delete
clientId
[49205] Fix | Delete
} = useBlockEditContext();
[49206] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
[49207] Fix | Delete
...props,
[49208] Fix | Delete
clientId: clientId
[49209] Fix | Delete
});
[49210] Fix | Delete
}, 'withClientId');
[49211] Fix | Delete
/* harmony default export */ const with_client_id = (withClientId);
[49212] Fix | Delete
[49213] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js
[49214] Fix | Delete
/**
[49215] Fix | Delete
* External dependencies
[49216] Fix | Delete
*/
[49217] Fix | Delete
[49218] Fix | Delete
[49219] Fix | Delete
/**
[49220] Fix | Delete
* Internal dependencies
[49221] Fix | Delete
*/
[49222] Fix | Delete
[49223] Fix | Delete
[49224] Fix | Delete
[49225] Fix | Delete
const button_block_appender_ButtonBlockAppender = ({
[49226] Fix | Delete
clientId,
[49227] Fix | Delete
showSeparator,
[49228] Fix | Delete
isFloating,
[49229] Fix | Delete
onAddBlock,
[49230] Fix | Delete
isToggle
[49231] Fix | Delete
}) => {
[49232] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, {
[49233] Fix | Delete
className: dist_clsx({
[49234] Fix | Delete
'block-list-appender__toggle': isToggle
[49235] Fix | Delete
}),
[49236] Fix | Delete
rootClientId: clientId,
[49237] Fix | Delete
showSeparator: showSeparator,
[49238] Fix | Delete
isFloating: isFloating,
[49239] Fix | Delete
onAddBlock: onAddBlock
[49240] Fix | Delete
});
[49241] Fix | Delete
};
[49242] Fix | Delete
/* harmony default export */ const inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender));
[49243] Fix | Delete
[49244] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js
[49245] Fix | Delete
/**
[49246] Fix | Delete
* WordPress dependencies
[49247] Fix | Delete
*/
[49248] Fix | Delete
[49249] Fix | Delete
[49250] Fix | Delete
[49251] Fix | Delete
/**
[49252] Fix | Delete
* Internal dependencies
[49253] Fix | Delete
*/
[49254] Fix | Delete
[49255] Fix | Delete
[49256] Fix | Delete
[49257] Fix | Delete
[49258] Fix | Delete
const default_block_appender_DefaultBlockAppender = ({
[49259] Fix | Delete
clientId
[49260] Fix | Delete
}) => {
[49261] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, {
[49262] Fix | Delete
rootClientId: clientId
[49263] Fix | Delete
});
[49264] Fix | Delete
};
[49265] Fix | Delete
/* harmony default export */ const default_block_appender = ((0,external_wp_compose_namespaceObject.compose)([with_client_id, (0,external_wp_data_namespaceObject.withSelect)((select, {
[49266] Fix | Delete
clientId
[49267] Fix | Delete
}) => {
[49268] Fix | Delete
const {
[49269] Fix | Delete
getBlockOrder
[49270] Fix | Delete
} = select(store);
[49271] Fix | Delete
const blockClientIds = getBlockOrder(clientId);
[49272] Fix | Delete
return {
[49273] Fix | Delete
lastBlockClientId: blockClientIds[blockClientIds.length - 1]
[49274] Fix | Delete
};
[49275] Fix | Delete
})])(default_block_appender_DefaultBlockAppender));
[49276] Fix | Delete
[49277] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js
[49278] Fix | Delete
/**
[49279] Fix | Delete
* WordPress dependencies
[49280] Fix | Delete
*/
[49281] Fix | Delete
[49282] Fix | Delete
[49283] Fix | Delete
[49284] Fix | Delete
[49285] Fix | Delete
[49286] Fix | Delete
/**
[49287] Fix | Delete
* Internal dependencies
[49288] Fix | Delete
*/
[49289] Fix | Delete
[49290] Fix | Delete
[49291] Fix | Delete
[49292] Fix | Delete
/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */
[49293] Fix | Delete
[49294] Fix | Delete
const pendingSettingsUpdates = new WeakMap();
[49295] Fix | Delete
function useShallowMemo(value) {
[49296] Fix | Delete
const [prevValue, setPrevValue] = (0,external_wp_element_namespaceObject.useState)(value);
[49297] Fix | Delete
if (!external_wp_isShallowEqual_default()(prevValue, value)) {
[49298] Fix | Delete
setPrevValue(value);
[49299] Fix | Delete
}
[49300] Fix | Delete
return prevValue;
[49301] Fix | Delete
}
[49302] Fix | Delete
[49303] Fix | Delete
/**
[49304] Fix | Delete
* This hook is a side effect which updates the block-editor store when changes
[49305] Fix | Delete
* happen to inner block settings. The given props are transformed into a
[49306] Fix | Delete
* settings object, and if that is different from the current settings object in
[49307] Fix | Delete
* the block-editor store, then the store is updated with the new settings which
[49308] Fix | Delete
* came from props.
[49309] Fix | Delete
*
[49310] Fix | Delete
* @param {string} clientId The client ID of the block to update.
[49311] Fix | Delete
* @param {string} parentLock
[49312] Fix | Delete
* @param {string[]} allowedBlocks An array of block names which are permitted
[49313] Fix | Delete
* in inner blocks.
[49314] Fix | Delete
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
[49315] Fix | Delete
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
[49316] Fix | Delete
* @param {?boolean} directInsert If a default block should be inserted directly by the appender.
[49317] Fix | Delete
*
[49318] Fix | Delete
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
[49319] Fix | Delete
*
[49320] Fix | Delete
* @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
[49321] Fix | Delete
*
[49322] Fix | Delete
* @param {string} [templateLock] The template lock specified for the inner
[49323] Fix | Delete
* blocks component. (e.g. "all")
[49324] Fix | Delete
* @param {boolean} captureToolbars Whether or children toolbars should be shown
[49325] Fix | Delete
* in the inner blocks component rather than on
[49326] Fix | Delete
* the child block.
[49327] Fix | Delete
* @param {string} orientation The direction in which the block
[49328] Fix | Delete
* should face.
[49329] Fix | Delete
* @param {Object} layout The layout object for the block container.
[49330] Fix | Delete
*/
[49331] Fix | Delete
function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
[49332] Fix | Delete
// Instead of adding a useSelect mapping here, please add to the useSelect
[49333] Fix | Delete
// mapping in InnerBlocks! Every subscription impacts performance.
[49334] Fix | Delete
[49335] Fix | Delete
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
[49336] Fix | Delete
[49337] Fix | Delete
// Implementors often pass a new array on every render,
[49338] Fix | Delete
// and the contents of the arrays are just strings, so the entire array
[49339] Fix | Delete
// can be passed as dependencies but We need to include the length of the array,
[49340] Fix | Delete
// otherwise if the arrays change length but the first elements are equal the comparison,
[49341] Fix | Delete
// does not works as expected.
[49342] Fix | Delete
const _allowedBlocks = useShallowMemo(allowedBlocks);
[49343] Fix | Delete
const _prioritizedInserterBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => prioritizedInserterBlocks,
[49344] Fix | Delete
// eslint-disable-next-line react-hooks/exhaustive-deps
[49345] Fix | Delete
prioritizedInserterBlocks);
[49346] Fix | Delete
const _templateLock = templateLock === undefined || parentLock === 'contentOnly' ? parentLock : templateLock;
[49347] Fix | Delete
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
[49348] Fix | Delete
const newSettings = {
[49349] Fix | Delete
allowedBlocks: _allowedBlocks,
[49350] Fix | Delete
prioritizedInserterBlocks: _prioritizedInserterBlocks,
[49351] Fix | Delete
templateLock: _templateLock
[49352] Fix | Delete
};
[49353] Fix | Delete
[49354] Fix | Delete
// These values are not defined for RN, so only include them if they
[49355] Fix | Delete
// are defined.
[49356] Fix | Delete
if (captureToolbars !== undefined) {
[49357] Fix | Delete
newSettings.__experimentalCaptureToolbars = captureToolbars;
[49358] Fix | Delete
}
[49359] Fix | Delete
[49360] Fix | Delete
// Orientation depends on layout,
[49361] Fix | Delete
// ideally the separate orientation prop should be deprecated.
[49362] Fix | Delete
if (orientation !== undefined) {
[49363] Fix | Delete
newSettings.orientation = orientation;
[49364] Fix | Delete
} else {
[49365] Fix | Delete
const layoutType = getLayoutType(layout?.type);
[49366] Fix | Delete
newSettings.orientation = layoutType.getOrientation(layout);
[49367] Fix | Delete
}
[49368] Fix | Delete
if (__experimentalDefaultBlock !== undefined) {
[49369] Fix | Delete
external_wp_deprecated_default()('__experimentalDefaultBlock', {
[49370] Fix | Delete
alternative: 'defaultBlock',
[49371] Fix | Delete
since: '6.3',
[49372] Fix | Delete
version: '6.4'
[49373] Fix | Delete
});
[49374] Fix | Delete
newSettings.defaultBlock = __experimentalDefaultBlock;
[49375] Fix | Delete
}
[49376] Fix | Delete
if (defaultBlock !== undefined) {
[49377] Fix | Delete
newSettings.defaultBlock = defaultBlock;
[49378] Fix | Delete
}
[49379] Fix | Delete
if (__experimentalDirectInsert !== undefined) {
[49380] Fix | Delete
external_wp_deprecated_default()('__experimentalDirectInsert', {
[49381] Fix | Delete
alternative: 'directInsert',
[49382] Fix | Delete
since: '6.3',
[49383] Fix | Delete
version: '6.4'
[49384] Fix | Delete
});
[49385] Fix | Delete
newSettings.directInsert = __experimentalDirectInsert;
[49386] Fix | Delete
}
[49387] Fix | Delete
if (directInsert !== undefined) {
[49388] Fix | Delete
newSettings.directInsert = directInsert;
[49389] Fix | Delete
}
[49390] Fix | Delete
if (newSettings.directInsert !== undefined && typeof newSettings.directInsert !== 'boolean') {
[49391] Fix | Delete
external_wp_deprecated_default()('Using `Function` as a `directInsert` argument', {
[49392] Fix | Delete
alternative: '`boolean` values',
[49393] Fix | Delete
since: '6.5'
[49394] Fix | Delete
});
[49395] Fix | Delete
}
[49396] Fix | Delete
[49397] Fix | Delete
// Batch updates to block list settings to avoid triggering cascading renders
[49398] Fix | Delete
// for each container block included in a tree and optimize initial render.
[49399] Fix | Delete
// To avoid triggering updateBlockListSettings for each container block
[49400] Fix | Delete
// causing X re-renderings for X container blocks,
[49401] Fix | Delete
// we batch all the updatedBlockListSettings in a single "data" batch
[49402] Fix | Delete
// which results in a single re-render.
[49403] Fix | Delete
if (!pendingSettingsUpdates.get(registry)) {
[49404] Fix | Delete
pendingSettingsUpdates.set(registry, {});
[49405] Fix | Delete
}
[49406] Fix | Delete
pendingSettingsUpdates.get(registry)[clientId] = newSettings;
[49407] Fix | Delete
window.queueMicrotask(() => {
[49408] Fix | Delete
const settings = pendingSettingsUpdates.get(registry);
[49409] Fix | Delete
if (Object.keys(settings).length) {
[49410] Fix | Delete
const {
[49411] Fix | Delete
updateBlockListSettings
[49412] Fix | Delete
} = registry.dispatch(store);
[49413] Fix | Delete
updateBlockListSettings(settings);
[49414] Fix | Delete
pendingSettingsUpdates.set(registry, {});
[49415] Fix | Delete
}
[49416] Fix | Delete
});
[49417] Fix | Delete
}, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, layout, registry]);
[49418] Fix | Delete
}
[49419] Fix | Delete
[49420] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js
[49421] Fix | Delete
/**
[49422] Fix | Delete
* External dependencies
[49423] Fix | Delete
*/
[49424] Fix | Delete
[49425] Fix | Delete
[49426] Fix | Delete
/**
[49427] Fix | Delete
* WordPress dependencies
[49428] Fix | Delete
*/
[49429] Fix | Delete
[49430] Fix | Delete
[49431] Fix | Delete
[49432] Fix | Delete
[49433] Fix | Delete
/**
[49434] Fix | Delete
* Internal dependencies
[49435] Fix | Delete
*/
[49436] Fix | Delete
[49437] Fix | Delete
[49438] Fix | Delete
/**
[49439] Fix | Delete
* This hook makes sure that a block's inner blocks stay in sync with the given
[49440] Fix | Delete
* block "template". The template is a block hierarchy to which inner blocks must
[49441] Fix | Delete
* conform. If the blocks get "out of sync" with the template and the template
[49442] Fix | Delete
* is meant to be locked (e.g. templateLock = "all" or templateLock = "contentOnly"),
[49443] Fix | Delete
* then we replace the inner blocks with the correct value after synchronizing it with the template.
[49444] Fix | Delete
*
[49445] Fix | Delete
* @param {string} clientId The block client ID.
[49446] Fix | Delete
* @param {Object} template The template to match.
[49447] Fix | Delete
* @param {string} templateLock The template lock state for the inner blocks. For
[49448] Fix | Delete
* example, if the template lock is set to "all",
[49449] Fix | Delete
* then the inner blocks will stay in sync with the
[49450] Fix | Delete
* template. If not defined or set to false, then
[49451] Fix | Delete
* the inner blocks will not be synchronized with
[49452] Fix | Delete
* the given template.
[49453] Fix | Delete
* @param {boolean} templateInsertUpdatesSelection Whether or not to update the
[49454] Fix | Delete
* block-editor selection state when inner blocks
[49455] Fix | Delete
* are replaced after template synchronization.
[49456] Fix | Delete
*/
[49457] Fix | Delete
function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) {
[49458] Fix | Delete
// Instead of adding a useSelect mapping here, please add to the useSelect
[49459] Fix | Delete
// mapping in InnerBlocks! Every subscription impacts performance.
[49460] Fix | Delete
[49461] Fix | Delete
const {
[49462] Fix | Delete
getBlocks,
[49463] Fix | Delete
getSelectedBlocksInitialCaretPosition,
[49464] Fix | Delete
isBlockSelected
[49465] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[49466] Fix | Delete
const {
[49467] Fix | Delete
replaceInnerBlocks,
[49468] Fix | Delete
__unstableMarkNextChangeAsNotPersistent
[49469] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[49470] Fix | Delete
[49471] Fix | Delete
// Maintain a reference to the previous value so we can do a deep equality check.
[49472] Fix | Delete
const existingTemplate = (0,external_wp_element_namespaceObject.useRef)(null);
[49473] Fix | Delete
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
[49474] Fix | Delete
let isCancelled = false;
[49475] Fix | Delete
[49476] Fix | Delete
// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate
[49477] Fix | Delete
// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),
[49478] Fix | Delete
// we need to schedule this one in a microtask as well.
[49479] Fix | Delete
// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.
[49480] Fix | Delete
window.queueMicrotask(() => {
[49481] Fix | Delete
if (isCancelled) {
[49482] Fix | Delete
return;
[49483] Fix | Delete
}
[49484] Fix | Delete
[49485] Fix | Delete
// Only synchronize innerBlocks with template if innerBlocks are empty
[49486] Fix | Delete
// or a locking "all" or "contentOnly" exists directly on the block.
[49487] Fix | Delete
const currentInnerBlocks = getBlocks(clientId);
[49488] Fix | Delete
const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === 'all' || templateLock === 'contentOnly';
[49489] Fix | Delete
const hasTemplateChanged = !es6_default()(template, existingTemplate.current);
[49490] Fix | Delete
if (!shouldApplyTemplate || !hasTemplateChanged) {
[49491] Fix | Delete
return;
[49492] Fix | Delete
}
[49493] Fix | Delete
existingTemplate.current = template;
[49494] Fix | Delete
const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(currentInnerBlocks, template);
[49495] Fix | Delete
if (!es6_default()(nextBlocks, currentInnerBlocks)) {
[49496] Fix | Delete
__unstableMarkNextChangeAsNotPersistent();
[49497] Fix | Delete
replaceInnerBlocks(clientId, nextBlocks, currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId),
[49498] Fix | Delete
// This ensures the "initialPosition" doesn't change when applying the template
[49499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function