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
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[36500] Fix | Delete
const customName = metadata?.name;
[36501] Fix | Delete
const hasPatternOverrides = !!customName && !!metadata?.bindings && Object.values(metadata.bindings).some(binding => binding.source === 'core/pattern-overrides');
[36502] Fix | Delete
function onChange(newName) {
[36503] Fix | Delete
updateBlockAttributes([clientId], {
[36504] Fix | Delete
metadata: {
[36505] Fix | Delete
...metadata,
[36506] Fix | Delete
name: newName
[36507] Fix | Delete
}
[36508] Fix | Delete
});
[36509] Fix | Delete
}
[36510] Fix | Delete
const blockInformation = useBlockDisplayInformation(clientId);
[36511] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[36512] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[36513] Fix | Delete
onClick: () => {
[36514] Fix | Delete
setRenamingBlock(true);
[36515] Fix | Delete
},
[36516] Fix | Delete
"aria-expanded": renamingBlock,
[36517] Fix | Delete
"aria-haspopup": "dialog",
[36518] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Rename')
[36519] Fix | Delete
}), renamingBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameModal, {
[36520] Fix | Delete
blockName: customName || '',
[36521] Fix | Delete
originalBlockName: blockInformation?.title,
[36522] Fix | Delete
hasOverridesWarning: hasPatternOverrides,
[36523] Fix | Delete
onClose: () => setRenamingBlock(false),
[36524] Fix | Delete
onSave: newName => {
[36525] Fix | Delete
// If the new value is the block's original name (e.g. `Group`)
[36526] Fix | Delete
// or it is an empty string then assume the intent is to reset
[36527] Fix | Delete
// the value. Therefore reset the metadata.
[36528] Fix | Delete
if (newName === blockInformation?.title || isEmptyString(newName)) {
[36529] Fix | Delete
newName = undefined;
[36530] Fix | Delete
}
[36531] Fix | Delete
onChange(newName);
[36532] Fix | Delete
}
[36533] Fix | Delete
})]
[36534] Fix | Delete
});
[36535] Fix | Delete
}
[36536] Fix | Delete
[36537] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js
[36538] Fix | Delete
/**
[36539] Fix | Delete
* WordPress dependencies
[36540] Fix | Delete
*/
[36541] Fix | Delete
[36542] Fix | Delete
[36543] Fix | Delete
[36544] Fix | Delete
[36545] Fix | Delete
[36546] Fix | Delete
/**
[36547] Fix | Delete
* Internal dependencies
[36548] Fix | Delete
*/
[36549] Fix | Delete
[36550] Fix | Delete
[36551] Fix | Delete
[36552] Fix | Delete
[36553] Fix | Delete
[36554] Fix | Delete
[36555] Fix | Delete
[36556] Fix | Delete
const {
[36557] Fix | Delete
Fill,
[36558] Fix | Delete
Slot
[36559] Fix | Delete
} = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls');
[36560] Fix | Delete
const BlockSettingsMenuControlsSlot = ({
[36561] Fix | Delete
fillProps,
[36562] Fix | Delete
clientIds = null
[36563] Fix | Delete
}) => {
[36564] Fix | Delete
const {
[36565] Fix | Delete
selectedBlocks,
[36566] Fix | Delete
selectedClientIds,
[36567] Fix | Delete
isContentOnly
[36568] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[36569] Fix | Delete
const {
[36570] Fix | Delete
getBlockNamesByClientId,
[36571] Fix | Delete
getSelectedBlockClientIds,
[36572] Fix | Delete
getBlockEditingMode
[36573] Fix | Delete
} = select(store);
[36574] Fix | Delete
const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds();
[36575] Fix | Delete
return {
[36576] Fix | Delete
selectedBlocks: getBlockNamesByClientId(ids),
[36577] Fix | Delete
selectedClientIds: ids,
[36578] Fix | Delete
isContentOnly: getBlockEditingMode(ids[0]) === 'contentOnly'
[36579] Fix | Delete
};
[36580] Fix | Delete
}, [clientIds]);
[36581] Fix | Delete
const {
[36582] Fix | Delete
canLock
[36583] Fix | Delete
} = useBlockLock(selectedClientIds[0]);
[36584] Fix | Delete
const {
[36585] Fix | Delete
canRename
[36586] Fix | Delete
} = useBlockRename(selectedBlocks[0]);
[36587] Fix | Delete
const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly;
[36588] Fix | Delete
const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly;
[36589] Fix | Delete
[36590] Fix | Delete
// Check if current selection of blocks is Groupable or Ungroupable
[36591] Fix | Delete
// and pass this props down to ConvertToGroupButton.
[36592] Fix | Delete
const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds);
[36593] Fix | Delete
const {
[36594] Fix | Delete
isGroupable,
[36595] Fix | Delete
isUngroupable
[36596] Fix | Delete
} = convertToGroupButtonProps;
[36597] Fix | Delete
const showConvertToGroupButton = isGroupable || isUngroupable;
[36598] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, {
[36599] Fix | Delete
fillProps: {
[36600] Fix | Delete
...fillProps,
[36601] Fix | Delete
selectedBlocks,
[36602] Fix | Delete
selectedClientIds
[36603] Fix | Delete
},
[36604] Fix | Delete
children: fills => {
[36605] Fix | Delete
if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) {
[36606] Fix | Delete
return null;
[36607] Fix | Delete
}
[36608] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
[36609] Fix | Delete
children: [showConvertToGroupButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToGroupButton, {
[36610] Fix | Delete
...convertToGroupButtonProps,
[36611] Fix | Delete
onClose: fillProps?.onClose
[36612] Fix | Delete
}), showLockButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockMenuItem, {
[36613] Fix | Delete
clientId: selectedClientIds[0]
[36614] Fix | Delete
}), showRenameButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameControl, {
[36615] Fix | Delete
clientId: selectedClientIds[0]
[36616] Fix | Delete
}), fills, fillProps?.canMove && !fillProps?.onlyBlock && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[36617] Fix | Delete
onClick: (0,external_wp_compose_namespaceObject.pipe)(fillProps?.onClose, fillProps?.onMoveTo),
[36618] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Move to')
[36619] Fix | Delete
}), fillProps?.count === 1 && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_mode_toggle, {
[36620] Fix | Delete
clientId: fillProps?.firstBlockClientId,
[36621] Fix | Delete
onToggle: fillProps?.onClose
[36622] Fix | Delete
})]
[36623] Fix | Delete
});
[36624] Fix | Delete
}
[36625] Fix | Delete
});
[36626] Fix | Delete
};
[36627] Fix | Delete
[36628] Fix | Delete
/**
[36629] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md
[36630] Fix | Delete
*
[36631] Fix | Delete
* @param {Object} props Fill props.
[36632] Fix | Delete
* @return {Element} Element.
[36633] Fix | Delete
*/
[36634] Fix | Delete
function BlockSettingsMenuControls({
[36635] Fix | Delete
...props
[36636] Fix | Delete
}) {
[36637] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
[36638] Fix | Delete
document: document,
[36639] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, {
[36640] Fix | Delete
...props
[36641] Fix | Delete
})
[36642] Fix | Delete
});
[36643] Fix | Delete
}
[36644] Fix | Delete
BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;
[36645] Fix | Delete
/* harmony default export */ const block_settings_menu_controls = (BlockSettingsMenuControls);
[36646] Fix | Delete
[36647] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js
[36648] Fix | Delete
/**
[36649] Fix | Delete
* WordPress dependencies
[36650] Fix | Delete
*/
[36651] Fix | Delete
[36652] Fix | Delete
[36653] Fix | Delete
[36654] Fix | Delete
[36655] Fix | Delete
[36656] Fix | Delete
/**
[36657] Fix | Delete
* Internal dependencies
[36658] Fix | Delete
*/
[36659] Fix | Delete
[36660] Fix | Delete
[36661] Fix | Delete
[36662] Fix | Delete
[36663] Fix | Delete
// The implementation of content locking is mainly in this file, although the mechanism
[36664] Fix | Delete
// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect
[36665] Fix | Delete
// at block-editor/src/components/block-list/index.js.
[36666] Fix | Delete
// Besides the components on this file and the file referenced above the implementation
[36667] Fix | Delete
// also includes artifacts on the store (actions, reducers, and selector).
[36668] Fix | Delete
[36669] Fix | Delete
[36670] Fix | Delete
[36671] Fix | Delete
function ContentLockControlsPure({
[36672] Fix | Delete
clientId,
[36673] Fix | Delete
isSelected
[36674] Fix | Delete
}) {
[36675] Fix | Delete
const {
[36676] Fix | Delete
templateLock,
[36677] Fix | Delete
isLockedByParent,
[36678] Fix | Delete
isEditingAsBlocks
[36679] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[36680] Fix | Delete
const {
[36681] Fix | Delete
getContentLockingParent,
[36682] Fix | Delete
getTemplateLock,
[36683] Fix | Delete
getTemporarilyEditingAsBlocks
[36684] Fix | Delete
} = unlock(select(store));
[36685] Fix | Delete
return {
[36686] Fix | Delete
templateLock: getTemplateLock(clientId),
[36687] Fix | Delete
isLockedByParent: !!getContentLockingParent(clientId),
[36688] Fix | Delete
isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId
[36689] Fix | Delete
};
[36690] Fix | Delete
}, [clientId]);
[36691] Fix | Delete
const {
[36692] Fix | Delete
stopEditingAsBlocks,
[36693] Fix | Delete
modifyContentLockBlock
[36694] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
[36695] Fix | Delete
const isContentLocked = !isLockedByParent && templateLock === 'contentOnly';
[36696] Fix | Delete
const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => {
[36697] Fix | Delete
stopEditingAsBlocks(clientId);
[36698] Fix | Delete
}, [clientId, stopEditingAsBlocks]);
[36699] Fix | Delete
if (!isContentLocked && !isEditingAsBlocks) {
[36700] Fix | Delete
return null;
[36701] Fix | Delete
}
[36702] Fix | Delete
const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked;
[36703] Fix | Delete
const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked && isSelected;
[36704] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[36705] Fix | Delete
children: [showStopEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[36706] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, {
[36707] Fix | Delete
group: "other",
[36708] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
[36709] Fix | Delete
onClick: stopEditingAsBlockCallback,
[36710] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Done')
[36711] Fix | Delete
})
[36712] Fix | Delete
})
[36713] Fix | Delete
}), showStartEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_controls, {
[36714] Fix | Delete
children: ({
[36715] Fix | Delete
selectedClientIds,
[36716] Fix | Delete
onClose
[36717] Fix | Delete
}) => selectedClientIds.length === 1 && selectedClientIds[0] === clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[36718] Fix | Delete
onClick: () => {
[36719] Fix | Delete
modifyContentLockBlock(clientId);
[36720] Fix | Delete
onClose();
[36721] Fix | Delete
},
[36722] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Modify')
[36723] Fix | Delete
})
[36724] Fix | Delete
})]
[36725] Fix | Delete
});
[36726] Fix | Delete
}
[36727] Fix | Delete
/* harmony default export */ const content_lock_ui = ({
[36728] Fix | Delete
edit: ContentLockControlsPure,
[36729] Fix | Delete
hasSupport() {
[36730] Fix | Delete
return true;
[36731] Fix | Delete
}
[36732] Fix | Delete
});
[36733] Fix | Delete
[36734] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js
[36735] Fix | Delete
/**
[36736] Fix | Delete
* WordPress dependencies
[36737] Fix | Delete
*/
[36738] Fix | Delete
[36739] Fix | Delete
const META_ATTRIBUTE_NAME = 'metadata';
[36740] Fix | Delete
[36741] Fix | Delete
/**
[36742] Fix | Delete
* Filters registered block settings, extending attributes to include `metadata`.
[36743] Fix | Delete
*
[36744] Fix | Delete
* see: https://github.com/WordPress/gutenberg/pull/40393/files#r864632012
[36745] Fix | Delete
*
[36746] Fix | Delete
* @param {Object} blockTypeSettings Original block settings.
[36747] Fix | Delete
* @return {Object} Filtered block settings.
[36748] Fix | Delete
*/
[36749] Fix | Delete
function addMetaAttribute(blockTypeSettings) {
[36750] Fix | Delete
// Allow blocks to specify their own attribute definition with default values if needed.
[36751] Fix | Delete
if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) {
[36752] Fix | Delete
return blockTypeSettings;
[36753] Fix | Delete
}
[36754] Fix | Delete
blockTypeSettings.attributes = {
[36755] Fix | Delete
...blockTypeSettings.attributes,
[36756] Fix | Delete
[META_ATTRIBUTE_NAME]: {
[36757] Fix | Delete
type: 'object'
[36758] Fix | Delete
}
[36759] Fix | Delete
};
[36760] Fix | Delete
return blockTypeSettings;
[36761] Fix | Delete
}
[36762] Fix | Delete
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute);
[36763] Fix | Delete
[36764] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
[36765] Fix | Delete
/**
[36766] Fix | Delete
* WordPress dependencies
[36767] Fix | Delete
*/
[36768] Fix | Delete
[36769] Fix | Delete
[36770] Fix | Delete
const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[36771] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[36772] Fix | Delete
viewBox: "0 0 24 24",
[36773] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[36774] Fix | Delete
d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
[36775] Fix | Delete
})
[36776] Fix | Delete
});
[36777] Fix | Delete
/* harmony default export */ const block_default = (blockDefault);
[36778] Fix | Delete
[36779] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js
[36780] Fix | Delete
/**
[36781] Fix | Delete
* External dependencies
[36782] Fix | Delete
*/
[36783] Fix | Delete
[36784] Fix | Delete
[36785] Fix | Delete
/**
[36786] Fix | Delete
* WordPress dependencies
[36787] Fix | Delete
*/
[36788] Fix | Delete
[36789] Fix | Delete
[36790] Fix | Delete
[36791] Fix | Delete
[36792] Fix | Delete
function BlockIcon({
[36793] Fix | Delete
icon,
[36794] Fix | Delete
showColors = false,
[36795] Fix | Delete
className,
[36796] Fix | Delete
context
[36797] Fix | Delete
}) {
[36798] Fix | Delete
if (icon?.src === 'block-default') {
[36799] Fix | Delete
icon = {
[36800] Fix | Delete
src: block_default
[36801] Fix | Delete
};
[36802] Fix | Delete
}
[36803] Fix | Delete
const renderedIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
[36804] Fix | Delete
icon: icon && icon.src ? icon.src : icon,
[36805] Fix | Delete
context: context
[36806] Fix | Delete
});
[36807] Fix | Delete
const style = showColors ? {
[36808] Fix | Delete
backgroundColor: icon && icon.background,
[36809] Fix | Delete
color: icon && icon.foreground
[36810] Fix | Delete
} : {};
[36811] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[36812] Fix | Delete
style: style,
[36813] Fix | Delete
className: dist_clsx('block-editor-block-icon', className, {
[36814] Fix | Delete
'has-colors': showColors
[36815] Fix | Delete
}),
[36816] Fix | Delete
children: renderedIcon
[36817] Fix | Delete
});
[36818] Fix | Delete
}
[36819] Fix | Delete
[36820] Fix | Delete
/**
[36821] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-icon/README.md
[36822] Fix | Delete
*/
[36823] Fix | Delete
/* harmony default export */ const block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon));
[36824] Fix | Delete
[36825] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js
[36826] Fix | Delete
/**
[36827] Fix | Delete
* WordPress dependencies
[36828] Fix | Delete
*/
[36829] Fix | Delete
[36830] Fix | Delete
[36831] Fix | Delete
[36832] Fix | Delete
[36833] Fix | Delete
[36834] Fix | Delete
[36835] Fix | Delete
/**
[36836] Fix | Delete
* Internal dependencies
[36837] Fix | Delete
*/
[36838] Fix | Delete
[36839] Fix | Delete
[36840] Fix | Delete
[36841] Fix | Delete
[36842] Fix | Delete
const block_hooks_EMPTY_OBJECT = {};
[36843] Fix | Delete
function BlockHooksControlPure({
[36844] Fix | Delete
name,
[36845] Fix | Delete
clientId,
[36846] Fix | Delete
metadata: {
[36847] Fix | Delete
ignoredHookedBlocks = []
[36848] Fix | Delete
} = {}
[36849] Fix | Delete
}) {
[36850] Fix | Delete
const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []);
[36851] Fix | Delete
[36852] Fix | Delete
// A hooked block added via a filter will not be exposed through a block
[36853] Fix | Delete
// type's `blockHooks` property; however, if the containing layout has been
[36854] Fix | Delete
// modified, it will be present in the anchor block's `ignoredHookedBlocks`
[36855] Fix | Delete
// metadata.
[36856] Fix | Delete
const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)(() => blockTypes?.filter(({
[36857] Fix | Delete
name: blockName,
[36858] Fix | Delete
blockHooks
[36859] Fix | Delete
}) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName)), [blockTypes, name, ignoredHookedBlocks]);
[36860] Fix | Delete
const {
[36861] Fix | Delete
blockIndex,
[36862] Fix | Delete
rootClientId,
[36863] Fix | Delete
innerBlocksLength
[36864] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[36865] Fix | Delete
const {
[36866] Fix | Delete
getBlocks,
[36867] Fix | Delete
getBlockIndex,
[36868] Fix | Delete
getBlockRootClientId
[36869] Fix | Delete
} = select(store);
[36870] Fix | Delete
return {
[36871] Fix | Delete
blockIndex: getBlockIndex(clientId),
[36872] Fix | Delete
innerBlocksLength: getBlocks(clientId)?.length,
[36873] Fix | Delete
rootClientId: getBlockRootClientId(clientId)
[36874] Fix | Delete
};
[36875] Fix | Delete
}, [clientId]);
[36876] Fix | Delete
const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
[36877] Fix | Delete
const {
[36878] Fix | Delete
getBlocks,
[36879] Fix | Delete
getGlobalBlockCount
[36880] Fix | Delete
} = select(store);
[36881] Fix | Delete
const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce((clientIds, block) => {
[36882] Fix | Delete
// If the block doesn't exist anywhere in the block tree,
[36883] Fix | Delete
// we know that we have to set the toggle to disabled.
[36884] Fix | Delete
if (getGlobalBlockCount(block.name) === 0) {
[36885] Fix | Delete
return clientIds;
[36886] Fix | Delete
}
[36887] Fix | Delete
const relativePosition = block?.blockHooks?.[name];
[36888] Fix | Delete
let candidates;
[36889] Fix | Delete
switch (relativePosition) {
[36890] Fix | Delete
case 'before':
[36891] Fix | Delete
case 'after':
[36892] Fix | Delete
// Any of the current block's siblings (with the right block type) qualifies
[36893] Fix | Delete
// as a hooked block (inserted `before` or `after` the current one), as the block
[36894] Fix | Delete
// might've been automatically inserted and then moved around a bit by the user.
[36895] Fix | Delete
candidates = getBlocks(rootClientId);
[36896] Fix | Delete
break;
[36897] Fix | Delete
case 'first_child':
[36898] Fix | Delete
case 'last_child':
[36899] Fix | Delete
// Any of the current block's child blocks (with the right block type) qualifies
[36900] Fix | Delete
// as a hooked first or last child block, as the block might've been automatically
[36901] Fix | Delete
// inserted and then moved around a bit by the user.
[36902] Fix | Delete
candidates = getBlocks(clientId);
[36903] Fix | Delete
break;
[36904] Fix | Delete
case undefined:
[36905] Fix | Delete
// If we haven't found a blockHooks field with a relative position for the hooked
[36906] Fix | Delete
// block, it means that it was added by a filter. In this case, we look for the block
[36907] Fix | Delete
// both among the current block's siblings and its children.
[36908] Fix | Delete
candidates = [...getBlocks(rootClientId), ...getBlocks(clientId)];
[36909] Fix | Delete
break;
[36910] Fix | Delete
}
[36911] Fix | Delete
const hookedBlock = candidates?.find(candidate => candidate.name === block.name);
[36912] Fix | Delete
[36913] Fix | Delete
// If the block exists in the designated location, we consider it hooked
[36914] Fix | Delete
// and show the toggle as enabled.
[36915] Fix | Delete
if (hookedBlock) {
[36916] Fix | Delete
return {
[36917] Fix | Delete
...clientIds,
[36918] Fix | Delete
[block.name]: hookedBlock.clientId
[36919] Fix | Delete
};
[36920] Fix | Delete
}
[36921] Fix | Delete
[36922] Fix | Delete
// If no hooked block was found in any of its designated locations,
[36923] Fix | Delete
// we set the toggle to disabled.
[36924] Fix | Delete
return clientIds;
[36925] Fix | Delete
}, {});
[36926] Fix | Delete
if (Object.values(_hookedBlockClientIds).length > 0) {
[36927] Fix | Delete
return _hookedBlockClientIds;
[36928] Fix | Delete
}
[36929] Fix | Delete
return block_hooks_EMPTY_OBJECT;
[36930] Fix | Delete
}, [hookedBlocksForCurrentBlock, name, clientId, rootClientId]);
[36931] Fix | Delete
const {
[36932] Fix | Delete
insertBlock,
[36933] Fix | Delete
removeBlock
[36934] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[36935] Fix | Delete
if (!hookedBlocksForCurrentBlock.length) {
[36936] Fix | Delete
return null;
[36937] Fix | Delete
}
[36938] Fix | Delete
[36939] Fix | Delete
// Group by block namespace (i.e. prefix before the slash).
[36940] Fix | Delete
const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce((groups, block) => {
[36941] Fix | Delete
const [namespace] = block.name.split('/');
[36942] Fix | Delete
if (!groups[namespace]) {
[36943] Fix | Delete
groups[namespace] = [];
[36944] Fix | Delete
}
[36945] Fix | Delete
groups[namespace].push(block);
[36946] Fix | Delete
return groups;
[36947] Fix | Delete
}, {});
[36948] Fix | Delete
const insertBlockIntoDesignatedLocation = (block, relativePosition) => {
[36949] Fix | Delete
switch (relativePosition) {
[36950] Fix | Delete
case 'before':
[36951] Fix | Delete
case 'after':
[36952] Fix | Delete
insertBlock(block, relativePosition === 'after' ? blockIndex + 1 : blockIndex, rootClientId,
[36953] Fix | Delete
// Insert as a child of the current block's parent
[36954] Fix | Delete
false);
[36955] Fix | Delete
break;
[36956] Fix | Delete
case 'first_child':
[36957] Fix | Delete
case 'last_child':
[36958] Fix | Delete
insertBlock(block,
[36959] Fix | Delete
// TODO: It'd be great if insertBlock() would accept negative indices for insertion.
[36960] Fix | Delete
relativePosition === 'first_child' ? 0 : innerBlocksLength, clientId,
[36961] Fix | Delete
// Insert as a child of the current block.
[36962] Fix | Delete
false);
[36963] Fix | Delete
break;
[36964] Fix | Delete
case undefined:
[36965] Fix | Delete
// If we do not know the relative position, it is because the block was
[36966] Fix | Delete
// added via a filter. In this case, we default to inserting it after the
[36967] Fix | Delete
// current block.
[36968] Fix | Delete
insertBlock(block, blockIndex + 1, rootClientId,
[36969] Fix | Delete
// Insert as a child of the current block's parent
[36970] Fix | Delete
false);
[36971] Fix | Delete
break;
[36972] Fix | Delete
}
[36973] Fix | Delete
};
[36974] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, {
[36975] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
[36976] Fix | Delete
className: "block-editor-hooks__block-hooks",
[36977] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
[36978] Fix | Delete
initialOpen: true,
[36979] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[36980] Fix | Delete
className: "block-editor-hooks__block-hooks-helptext",
[36981] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Manage the inclusion of blocks added automatically by plugins.')
[36982] Fix | Delete
}), Object.keys(groupedHookedBlocks).map(vendor => {
[36983] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, {
[36984] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", {
[36985] Fix | Delete
children: vendor
[36986] Fix | Delete
}), groupedHookedBlocks[vendor].map(block => {
[36987] Fix | Delete
const checked = (block.name in hookedBlockClientIds);
[36988] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
[36989] Fix | Delete
checked: checked,
[36990] Fix | Delete
label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[36991] Fix | Delete
justify: "flex-start",
[36992] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, {
[36993] Fix | Delete
icon: block.icon
[36994] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[36995] Fix | Delete
children: block.title
[36996] Fix | Delete
})]
[36997] Fix | Delete
}),
[36998] Fix | Delete
onChange: () => {
[36999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function