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
})]
[45500] Fix | Delete
});
[45501] Fix | Delete
}
[45502] Fix | Delete
[45503] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js
[45504] Fix | Delete
/**
[45505] Fix | Delete
* External dependencies
[45506] Fix | Delete
*/
[45507] Fix | Delete
[45508] Fix | Delete
[45509] Fix | Delete
/**
[45510] Fix | Delete
* WordPress dependencies
[45511] Fix | Delete
*/
[45512] Fix | Delete
[45513] Fix | Delete
[45514] Fix | Delete
[45515] Fix | Delete
[45516] Fix | Delete
[45517] Fix | Delete
[45518] Fix | Delete
[45519] Fix | Delete
/**
[45520] Fix | Delete
* Internal dependencies
[45521] Fix | Delete
*/
[45522] Fix | Delete
[45523] Fix | Delete
[45524] Fix | Delete
[45525] Fix | Delete
[45526] Fix | Delete
[45527] Fix | Delete
[45528] Fix | Delete
[45529] Fix | Delete
[45530] Fix | Delete
const {
[45531] Fix | Delete
CompositeV2: block_patterns_list_Composite,
[45532] Fix | Delete
CompositeItemV2: block_patterns_list_CompositeItem,
[45533] Fix | Delete
useCompositeStoreV2: block_patterns_list_useCompositeStore
[45534] Fix | Delete
} = unlock(external_wp_components_namespaceObject.privateApis);
[45535] Fix | Delete
const WithToolTip = ({
[45536] Fix | Delete
showTooltip,
[45537] Fix | Delete
title,
[45538] Fix | Delete
children
[45539] Fix | Delete
}) => {
[45540] Fix | Delete
if (showTooltip) {
[45541] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
[45542] Fix | Delete
text: title,
[45543] Fix | Delete
children: children
[45544] Fix | Delete
});
[45545] Fix | Delete
}
[45546] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[45547] Fix | Delete
children: children
[45548] Fix | Delete
});
[45549] Fix | Delete
};
[45550] Fix | Delete
function BlockPattern({
[45551] Fix | Delete
id,
[45552] Fix | Delete
isDraggable,
[45553] Fix | Delete
pattern,
[45554] Fix | Delete
onClick,
[45555] Fix | Delete
onHover,
[45556] Fix | Delete
showTitle = true,
[45557] Fix | Delete
showTooltip,
[45558] Fix | Delete
category
[45559] Fix | Delete
}) {
[45560] Fix | Delete
const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false);
[45561] Fix | Delete
const {
[45562] Fix | Delete
blocks,
[45563] Fix | Delete
viewportWidth
[45564] Fix | Delete
} = pattern;
[45565] Fix | Delete
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
[45566] Fix | Delete
const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
[45567] Fix | Delete
[45568] Fix | Delete
// When we have a selected category and the pattern is draggable, we need to update the
[45569] Fix | Delete
// pattern's categories in metadata to only contain the selected category, and pass this to
[45570] Fix | Delete
// InserterDraggableBlocks component. We do that because we use this information for pattern
[45571] Fix | Delete
// shuffling and it makes more sense to show only the ones from the initially selected category during insertion.
[45572] Fix | Delete
const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
[45573] Fix | Delete
if (!category || !isDraggable) {
[45574] Fix | Delete
return blocks;
[45575] Fix | Delete
}
[45576] Fix | Delete
return (blocks !== null && blocks !== void 0 ? blocks : []).map(block => {
[45577] Fix | Delete
const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
[45578] Fix | Delete
if (clonedBlock.attributes.metadata?.categories?.includes(category)) {
[45579] Fix | Delete
clonedBlock.attributes.metadata.categories = [category];
[45580] Fix | Delete
}
[45581] Fix | Delete
return clonedBlock;
[45582] Fix | Delete
});
[45583] Fix | Delete
}, [blocks, isDraggable, category]);
[45584] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, {
[45585] Fix | Delete
isEnabled: isDraggable,
[45586] Fix | Delete
blocks: patternBlocks,
[45587] Fix | Delete
pattern: pattern,
[45588] Fix | Delete
children: ({
[45589] Fix | Delete
draggable,
[45590] Fix | Delete
onDragStart,
[45591] Fix | Delete
onDragEnd
[45592] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[45593] Fix | Delete
className: "block-editor-block-patterns-list__list-item",
[45594] Fix | Delete
draggable: draggable,
[45595] Fix | Delete
onDragStart: event => {
[45596] Fix | Delete
setIsDragging(true);
[45597] Fix | Delete
if (onDragStart) {
[45598] Fix | Delete
onHover?.(null);
[45599] Fix | Delete
onDragStart(event);
[45600] Fix | Delete
}
[45601] Fix | Delete
},
[45602] Fix | Delete
onDragEnd: event => {
[45603] Fix | Delete
setIsDragging(false);
[45604] Fix | Delete
if (onDragEnd) {
[45605] Fix | Delete
onDragEnd(event);
[45606] Fix | Delete
}
[45607] Fix | Delete
},
[45608] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolTip, {
[45609] Fix | Delete
showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user,
[45610] Fix | Delete
title: pattern.title,
[45611] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_patterns_list_CompositeItem, {
[45612] Fix | Delete
render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[45613] Fix | Delete
role: "option",
[45614] Fix | Delete
"aria-label": pattern.title,
[45615] Fix | Delete
"aria-describedby": pattern.description ? descriptionId : undefined,
[45616] Fix | Delete
className: dist_clsx('block-editor-block-patterns-list__item', {
[45617] Fix | Delete
'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus
[45618] Fix | Delete
})
[45619] Fix | Delete
}),
[45620] Fix | Delete
id: id,
[45621] Fix | Delete
onClick: () => {
[45622] Fix | Delete
onClick(pattern, blocks);
[45623] Fix | Delete
onHover?.(null);
[45624] Fix | Delete
},
[45625] Fix | Delete
onMouseEnter: () => {
[45626] Fix | Delete
if (isDragging) {
[45627] Fix | Delete
return;
[45628] Fix | Delete
}
[45629] Fix | Delete
onHover?.(pattern);
[45630] Fix | Delete
},
[45631] Fix | Delete
onMouseLeave: () => onHover?.(null),
[45632] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, {
[45633] Fix | Delete
blocks: blocks,
[45634] Fix | Delete
viewportWidth: viewportWidth
[45635] Fix | Delete
}), showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[45636] Fix | Delete
className: "block-editor-patterns__pattern-details",
[45637] Fix | Delete
spacing: 2,
[45638] Fix | Delete
children: [pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[45639] Fix | Delete
className: "block-editor-patterns__pattern-icon-wrapper",
[45640] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
[45641] Fix | Delete
className: "block-editor-patterns__pattern-icon",
[45642] Fix | Delete
icon: library_symbol
[45643] Fix | Delete
})
[45644] Fix | Delete
}), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[45645] Fix | Delete
className: "block-editor-block-patterns-list__item-title",
[45646] Fix | Delete
children: pattern.title
[45647] Fix | Delete
})]
[45648] Fix | Delete
}), !!pattern.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
[45649] Fix | Delete
id: descriptionId,
[45650] Fix | Delete
children: pattern.description
[45651] Fix | Delete
})]
[45652] Fix | Delete
})
[45653] Fix | Delete
})
[45654] Fix | Delete
})
[45655] Fix | Delete
});
[45656] Fix | Delete
}
[45657] Fix | Delete
function BlockPatternPlaceholder() {
[45658] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[45659] Fix | Delete
className: "block-editor-block-patterns-list__item is-placeholder"
[45660] Fix | Delete
});
[45661] Fix | Delete
}
[45662] Fix | Delete
function BlockPatternsList({
[45663] Fix | Delete
isDraggable,
[45664] Fix | Delete
blockPatterns,
[45665] Fix | Delete
shownPatterns,
[45666] Fix | Delete
onHover,
[45667] Fix | Delete
onClickPattern,
[45668] Fix | Delete
orientation,
[45669] Fix | Delete
label = (0,external_wp_i18n_namespaceObject.__)('Block patterns'),
[45670] Fix | Delete
category,
[45671] Fix | Delete
showTitle = true,
[45672] Fix | Delete
showTitlesAsTooltip,
[45673] Fix | Delete
pagingProps
[45674] Fix | Delete
}, ref) {
[45675] Fix | Delete
const compositeStore = block_patterns_list_useCompositeStore({
[45676] Fix | Delete
orientation
[45677] Fix | Delete
});
[45678] Fix | Delete
const {
[45679] Fix | Delete
setActiveId
[45680] Fix | Delete
} = compositeStore;
[45681] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[45682] Fix | Delete
// We reset the active composite item whenever the
[45683] Fix | Delete
// available patterns change, to make sure that
[45684] Fix | Delete
// focus is put back to the start.
[45685] Fix | Delete
setActiveId(undefined);
[45686] Fix | Delete
}, [setActiveId, shownPatterns, blockPatterns]);
[45687] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_patterns_list_Composite, {
[45688] Fix | Delete
store: compositeStore,
[45689] Fix | Delete
role: "listbox",
[45690] Fix | Delete
className: "block-editor-block-patterns-list",
[45691] Fix | Delete
"aria-label": label,
[45692] Fix | Delete
ref: ref,
[45693] Fix | Delete
children: [blockPatterns.map(pattern => {
[45694] Fix | Delete
const isShown = shownPatterns.includes(pattern);
[45695] Fix | Delete
return isShown ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPattern, {
[45696] Fix | Delete
id: pattern.name,
[45697] Fix | Delete
pattern: pattern,
[45698] Fix | Delete
onClick: onClickPattern,
[45699] Fix | Delete
onHover: onHover,
[45700] Fix | Delete
isDraggable: isDraggable,
[45701] Fix | Delete
showTitle: showTitle,
[45702] Fix | Delete
showTooltip: showTitlesAsTooltip,
[45703] Fix | Delete
category: category
[45704] Fix | Delete
}, pattern.name) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}, pattern.name);
[45705] Fix | Delete
}), pagingProps && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, {
[45706] Fix | Delete
...pagingProps
[45707] Fix | Delete
})]
[45708] Fix | Delete
});
[45709] Fix | Delete
}
[45710] Fix | Delete
/* harmony default export */ const block_patterns_list = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList));
[45711] Fix | Delete
[45712] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
[45713] Fix | Delete
/**
[45714] Fix | Delete
* WordPress dependencies
[45715] Fix | Delete
*/
[45716] Fix | Delete
[45717] Fix | Delete
[45718] Fix | Delete
[45719] Fix | Delete
[45720] Fix | Delete
[45721] Fix | Delete
[45722] Fix | Delete
/**
[45723] Fix | Delete
* Internal dependencies
[45724] Fix | Delete
*/
[45725] Fix | Delete
[45726] Fix | Delete
[45727] Fix | Delete
function getIndex({
[45728] Fix | Delete
destinationRootClientId,
[45729] Fix | Delete
destinationIndex,
[45730] Fix | Delete
rootClientId,
[45731] Fix | Delete
registry
[45732] Fix | Delete
}) {
[45733] Fix | Delete
if (rootClientId === destinationRootClientId) {
[45734] Fix | Delete
return destinationIndex;
[45735] Fix | Delete
}
[45736] Fix | Delete
const parents = ['', ...registry.select(store).getBlockParents(destinationRootClientId), destinationRootClientId];
[45737] Fix | Delete
const parentIndex = parents.indexOf(rootClientId);
[45738] Fix | Delete
if (parentIndex !== -1) {
[45739] Fix | Delete
return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1;
[45740] Fix | Delete
}
[45741] Fix | Delete
return registry.select(store).getBlockOrder(rootClientId).length;
[45742] Fix | Delete
}
[45743] Fix | Delete
[45744] Fix | Delete
/**
[45745] Fix | Delete
* @typedef WPInserterConfig
[45746] Fix | Delete
*
[45747] Fix | Delete
* @property {string=} rootClientId If set, insertion will be into the
[45748] Fix | Delete
* block with this ID.
[45749] Fix | Delete
* @property {number=} insertionIndex If set, insertion will be into this
[45750] Fix | Delete
* explicit position.
[45751] Fix | Delete
* @property {string=} clientId If set, insertion will be after the
[45752] Fix | Delete
* block with this ID.
[45753] Fix | Delete
* @property {boolean=} isAppender Whether the inserter is an appender
[45754] Fix | Delete
* or not.
[45755] Fix | Delete
* @property {Function=} onSelect Called after insertion.
[45756] Fix | Delete
*/
[45757] Fix | Delete
[45758] Fix | Delete
/**
[45759] Fix | Delete
* Returns the insertion point state given the inserter config.
[45760] Fix | Delete
*
[45761] Fix | Delete
* @param {WPInserterConfig} config Inserter Config.
[45762] Fix | Delete
* @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle).
[45763] Fix | Delete
*/
[45764] Fix | Delete
function useInsertionPoint({
[45765] Fix | Delete
rootClientId = '',
[45766] Fix | Delete
insertionIndex,
[45767] Fix | Delete
clientId,
[45768] Fix | Delete
isAppender,
[45769] Fix | Delete
onSelect,
[45770] Fix | Delete
shouldFocusBlock = true,
[45771] Fix | Delete
selectBlockOnInsert = true
[45772] Fix | Delete
}) {
[45773] Fix | Delete
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
[45774] Fix | Delete
const {
[45775] Fix | Delete
getSelectedBlock
[45776] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[45777] Fix | Delete
const {
[45778] Fix | Delete
destinationRootClientId,
[45779] Fix | Delete
destinationIndex
[45780] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[45781] Fix | Delete
const {
[45782] Fix | Delete
getSelectedBlockClientId,
[45783] Fix | Delete
getBlockRootClientId,
[45784] Fix | Delete
getBlockIndex,
[45785] Fix | Delete
getBlockOrder
[45786] Fix | Delete
} = select(store);
[45787] Fix | Delete
const selectedBlockClientId = getSelectedBlockClientId();
[45788] Fix | Delete
let _destinationRootClientId = rootClientId;
[45789] Fix | Delete
let _destinationIndex;
[45790] Fix | Delete
if (insertionIndex !== undefined) {
[45791] Fix | Delete
// Insert into a specific index.
[45792] Fix | Delete
_destinationIndex = insertionIndex;
[45793] Fix | Delete
} else if (clientId) {
[45794] Fix | Delete
// Insert after a specific client ID.
[45795] Fix | Delete
_destinationIndex = getBlockIndex(clientId);
[45796] Fix | Delete
} else if (!isAppender && selectedBlockClientId) {
[45797] Fix | Delete
_destinationRootClientId = getBlockRootClientId(selectedBlockClientId);
[45798] Fix | Delete
_destinationIndex = getBlockIndex(selectedBlockClientId) + 1;
[45799] Fix | Delete
} else {
[45800] Fix | Delete
// Insert at the end of the list.
[45801] Fix | Delete
_destinationIndex = getBlockOrder(_destinationRootClientId).length;
[45802] Fix | Delete
}
[45803] Fix | Delete
return {
[45804] Fix | Delete
destinationRootClientId: _destinationRootClientId,
[45805] Fix | Delete
destinationIndex: _destinationIndex
[45806] Fix | Delete
};
[45807] Fix | Delete
}, [rootClientId, insertionIndex, clientId, isAppender]);
[45808] Fix | Delete
const {
[45809] Fix | Delete
replaceBlocks,
[45810] Fix | Delete
insertBlocks,
[45811] Fix | Delete
showInsertionPoint,
[45812] Fix | Delete
hideInsertionPoint,
[45813] Fix | Delete
setLastFocus
[45814] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
[45815] Fix | Delete
const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false, _rootClientId) => {
[45816] Fix | Delete
// When we are trying to move focus or select a new block on insert, we also
[45817] Fix | Delete
// need to clear the last focus to avoid the focus being set to the wrong block
[45818] Fix | Delete
// when tabbing back into the canvas if the block was added from outside the
[45819] Fix | Delete
// editor canvas.
[45820] Fix | Delete
if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) {
[45821] Fix | Delete
setLastFocus(null);
[45822] Fix | Delete
}
[45823] Fix | Delete
const selectedBlock = getSelectedBlock();
[45824] Fix | Delete
if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) {
[45825] Fix | Delete
replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
[45826] Fix | Delete
} else {
[45827] Fix | Delete
insertBlocks(blocks, isAppender || _rootClientId === undefined ? destinationIndex : getIndex({
[45828] Fix | Delete
destinationRootClientId,
[45829] Fix | Delete
destinationIndex,
[45830] Fix | Delete
rootClientId: _rootClientId,
[45831] Fix | Delete
registry
[45832] Fix | Delete
}), isAppender || _rootClientId === undefined ? destinationRootClientId : _rootClientId, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
[45833] Fix | Delete
}
[45834] Fix | Delete
const blockLength = Array.isArray(blocks) ? blocks.length : 1;
[45835] Fix | Delete
const message = (0,external_wp_i18n_namespaceObject.sprintf)(
[45836] Fix | Delete
// translators: %d: the name of the block that has been added
[45837] Fix | Delete
(0,external_wp_i18n_namespaceObject._n)('%d block added.', '%d blocks added.', blockLength), blockLength);
[45838] Fix | Delete
(0,external_wp_a11y_namespaceObject.speak)(message);
[45839] Fix | Delete
if (onSelect) {
[45840] Fix | Delete
onSelect(blocks);
[45841] Fix | Delete
}
[45842] Fix | Delete
}, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock, selectBlockOnInsert]);
[45843] Fix | Delete
const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(item => {
[45844] Fix | Delete
if (item?.hasOwnProperty('rootClientId')) {
[45845] Fix | Delete
showInsertionPoint(item.rootClientId, getIndex({
[45846] Fix | Delete
destinationRootClientId,
[45847] Fix | Delete
destinationIndex,
[45848] Fix | Delete
rootClientId: item.rootClientId,
[45849] Fix | Delete
registry
[45850] Fix | Delete
}));
[45851] Fix | Delete
} else {
[45852] Fix | Delete
hideInsertionPoint();
[45853] Fix | Delete
}
[45854] Fix | Delete
}, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]);
[45855] Fix | Delete
return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint];
[45856] Fix | Delete
}
[45857] Fix | Delete
/* harmony default export */ const use_insertion_point = (useInsertionPoint);
[45858] Fix | Delete
[45859] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
[45860] Fix | Delete
/**
[45861] Fix | Delete
* WordPress dependencies
[45862] Fix | Delete
*/
[45863] Fix | Delete
[45864] Fix | Delete
[45865] Fix | Delete
[45866] Fix | Delete
[45867] Fix | Delete
[45868] Fix | Delete
[45869] Fix | Delete
/**
[45870] Fix | Delete
* Internal dependencies
[45871] Fix | Delete
*/
[45872] Fix | Delete
[45873] Fix | Delete
[45874] Fix | Delete
[45875] Fix | Delete
/**
[45876] Fix | Delete
* Retrieves the block patterns inserter state.
[45877] Fix | Delete
*
[45878] Fix | Delete
* @param {Function} onInsert function called when inserter a list of blocks.
[45879] Fix | Delete
* @param {string=} rootClientId Insertion's root client ID.
[45880] Fix | Delete
*
[45881] Fix | Delete
* @param {string} selectedCategory The selected pattern category.
[45882] Fix | Delete
* @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
[45883] Fix | Delete
*/
[45884] Fix | Delete
const usePatternsState = (onInsert, rootClientId, selectedCategory) => {
[45885] Fix | Delete
const {
[45886] Fix | Delete
patternCategories,
[45887] Fix | Delete
patterns,
[45888] Fix | Delete
userPatternCategories
[45889] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[45890] Fix | Delete
const {
[45891] Fix | Delete
__experimentalGetAllowedPatterns,
[45892] Fix | Delete
getSettings
[45893] Fix | Delete
} = select(store);
[45894] Fix | Delete
const {
[45895] Fix | Delete
__experimentalUserPatternCategories,
[45896] Fix | Delete
__experimentalBlockPatternCategories
[45897] Fix | Delete
} = getSettings();
[45898] Fix | Delete
return {
[45899] Fix | Delete
patterns: __experimentalGetAllowedPatterns(rootClientId),
[45900] Fix | Delete
userPatternCategories: __experimentalUserPatternCategories,
[45901] Fix | Delete
patternCategories: __experimentalBlockPatternCategories
[45902] Fix | Delete
};
[45903] Fix | Delete
}, [rootClientId]);
[45904] Fix | Delete
const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
[45905] Fix | Delete
const categories = [...patternCategories];
[45906] Fix | Delete
userPatternCategories?.forEach(userCategory => {
[45907] Fix | Delete
if (!categories.find(existingCategory => existingCategory.name === userCategory.name)) {
[45908] Fix | Delete
categories.push(userCategory);
[45909] Fix | Delete
}
[45910] Fix | Delete
});
[45911] Fix | Delete
return categories;
[45912] Fix | Delete
}, [patternCategories, userPatternCategories]);
[45913] Fix | Delete
const {
[45914] Fix | Delete
createSuccessNotice
[45915] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[45916] Fix | Delete
const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => {
[45917] Fix | Delete
const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', {
[45918] Fix | Delete
ref: pattern.id
[45919] Fix | Delete
})] : blocks;
[45920] Fix | Delete
onInsert((patternBlocks !== null && patternBlocks !== void 0 ? patternBlocks : []).map(block => {
[45921] Fix | Delete
const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
[45922] Fix | Delete
if (clonedBlock.attributes.metadata?.categories?.includes(selectedCategory)) {
[45923] Fix | Delete
clonedBlock.attributes.metadata.categories = [selectedCategory];
[45924] Fix | Delete
}
[45925] Fix | Delete
return clonedBlock;
[45926] Fix | Delete
}), pattern.name);
[45927] Fix | Delete
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block pattern title. */
[45928] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), {
[45929] Fix | Delete
type: 'snackbar',
[45930] Fix | Delete
id: 'block-pattern-inserted-notice'
[45931] Fix | Delete
});
[45932] Fix | Delete
}, [createSuccessNotice, onInsert, selectedCategory]);
[45933] Fix | Delete
return [patterns, allCategories, onClickPattern];
[45934] Fix | Delete
};
[45935] Fix | Delete
/* harmony default export */ const use_patterns_state = (usePatternsState);
[45936] Fix | Delete
[45937] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js
[45938] Fix | Delete
/**
[45939] Fix | Delete
* WordPress dependencies
[45940] Fix | Delete
*/
[45941] Fix | Delete
[45942] Fix | Delete
[45943] Fix | Delete
[45944] Fix | Delete
const PAGE_SIZE = 20;
[45945] Fix | Delete
const INITIAL_INSERTER_RESULTS = 5;
[45946] Fix | Delete
[45947] Fix | Delete
/**
[45948] Fix | Delete
* Supplies values needed to page the patterns list client side.
[45949] Fix | Delete
*
[45950] Fix | Delete
* @param {Array} currentCategoryPatterns An array of the current patterns to display.
[45951] Fix | Delete
* @param {string} currentCategory The currently selected category.
[45952] Fix | Delete
* @param {Object} scrollContainerRef Ref of container to to find scroll container for when moving between pages.
[45953] Fix | Delete
* @param {string} currentFilter The currently search filter.
[45954] Fix | Delete
*
[45955] Fix | Delete
* @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage)
[45956] Fix | Delete
*/
[45957] Fix | Delete
function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = '') {
[45958] Fix | Delete
const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1);
[45959] Fix | Delete
const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory);
[45960] Fix | Delete
const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter);
[45961] Fix | Delete
if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) {
[45962] Fix | Delete
setCurrentPage(1);
[45963] Fix | Delete
}
[45964] Fix | Delete
const totalItems = currentCategoryPatterns.length;
[45965] Fix | Delete
const pageIndex = currentPage - 1;
[45966] Fix | Delete
const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
[45967] Fix | Delete
return currentCategoryPatterns.slice(pageIndex * PAGE_SIZE, pageIndex * PAGE_SIZE + PAGE_SIZE);
[45968] Fix | Delete
}, [pageIndex, currentCategoryPatterns]);
[45969] Fix | Delete
const categoryPatternsAsyncList = (0,external_wp_compose_namespaceObject.useAsyncList)(categoryPatterns, {
[45970] Fix | Delete
step: INITIAL_INSERTER_RESULTS
[45971] Fix | Delete
});
[45972] Fix | Delete
const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE);
[45973] Fix | Delete
const changePage = page => {
[45974] Fix | Delete
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current);
[45975] Fix | Delete
scrollContainer?.scrollTo(0, 0);
[45976] Fix | Delete
setCurrentPage(page);
[45977] Fix | Delete
};
[45978] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(function scrollToTopOnCategoryChange() {
[45979] Fix | Delete
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current);
[45980] Fix | Delete
scrollContainer?.scrollTo(0, 0);
[45981] Fix | Delete
}, [currentCategory, scrollContainerRef]);
[45982] Fix | Delete
return {
[45983] Fix | Delete
totalItems,
[45984] Fix | Delete
categoryPatterns,
[45985] Fix | Delete
categoryPatternsAsyncList,
[45986] Fix | Delete
numPages,
[45987] Fix | Delete
changePage,
[45988] Fix | Delete
currentPage
[45989] Fix | Delete
};
[45990] Fix | Delete
}
[45991] Fix | Delete
[45992] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js
[45993] Fix | Delete
/**
[45994] Fix | Delete
* WordPress dependencies
[45995] Fix | Delete
*/
[45996] Fix | Delete
[45997] Fix | Delete
[45998] Fix | Delete
[45999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function