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
const getIsHovered = () => {
[52000] Fix | Delete
return ref?.current && ref.current.matches(':hover');
[52001] Fix | Delete
};
[52002] Fix | Delete
const shouldHideGestures = () => {
[52003] Fix | Delete
const isHovered = getIsHovered();
[52004] Fix | Delete
return !isFocused && !isHovered;
[52005] Fix | Delete
};
[52006] Fix | Delete
const clearTimeoutRef = () => {
[52007] Fix | Delete
const timeout = timeoutRef.current;
[52008] Fix | Delete
if (timeout && utils_clearTimeout) {
[52009] Fix | Delete
utils_clearTimeout(timeout);
[52010] Fix | Delete
}
[52011] Fix | Delete
};
[52012] Fix | Delete
const debouncedShowGestures = event => {
[52013] Fix | Delete
if (event) {
[52014] Fix | Delete
event.stopPropagation();
[52015] Fix | Delete
}
[52016] Fix | Delete
clearTimeoutRef();
[52017] Fix | Delete
handleOnChange(true);
[52018] Fix | Delete
};
[52019] Fix | Delete
const debouncedHideGestures = event => {
[52020] Fix | Delete
if (event) {
[52021] Fix | Delete
event.stopPropagation();
[52022] Fix | Delete
}
[52023] Fix | Delete
clearTimeoutRef();
[52024] Fix | Delete
timeoutRef.current = utils_setTimeout(() => {
[52025] Fix | Delete
if (shouldHideGestures()) {
[52026] Fix | Delete
handleOnChange(false);
[52027] Fix | Delete
}
[52028] Fix | Delete
}, debounceTimeout);
[52029] Fix | Delete
};
[52030] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => () => {
[52031] Fix | Delete
/**
[52032] Fix | Delete
* We need to call the change handler with `isFocused`
[52033] Fix | Delete
* set to false on unmount because we also clear the
[52034] Fix | Delete
* timeout that would handle that.
[52035] Fix | Delete
*/
[52036] Fix | Delete
handleOnChange(false);
[52037] Fix | Delete
clearTimeoutRef();
[52038] Fix | Delete
}, []);
[52039] Fix | Delete
return {
[52040] Fix | Delete
debouncedShowGestures,
[52041] Fix | Delete
debouncedHideGestures
[52042] Fix | Delete
};
[52043] Fix | Delete
}
[52044] Fix | Delete
[52045] Fix | Delete
/**
[52046] Fix | Delete
* Hook that provides gesture events for DOM elements
[52047] Fix | Delete
* that interact with the isFocused state.
[52048] Fix | Delete
*
[52049] Fix | Delete
* @param {Object} props Component props.
[52050] Fix | Delete
* @param {Object} props.ref Element reference.
[52051] Fix | Delete
* @param {number} [props.highlightParent=false] Whether to highlight the parent block. It defaults to highlighting the selected block.
[52052] Fix | Delete
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
[52053] Fix | Delete
*/
[52054] Fix | Delete
function useShowHoveredOrFocusedGestures({
[52055] Fix | Delete
ref,
[52056] Fix | Delete
highlightParent = false,
[52057] Fix | Delete
debounceTimeout = DEBOUNCE_TIMEOUT
[52058] Fix | Delete
}) {
[52059] Fix | Delete
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
[52060] Fix | Delete
const {
[52061] Fix | Delete
debouncedShowGestures,
[52062] Fix | Delete
debouncedHideGestures
[52063] Fix | Delete
} = useDebouncedShowGestures({
[52064] Fix | Delete
ref,
[52065] Fix | Delete
debounceTimeout,
[52066] Fix | Delete
isFocused,
[52067] Fix | Delete
highlightParent
[52068] Fix | Delete
});
[52069] Fix | Delete
const registerRef = (0,external_wp_element_namespaceObject.useRef)(false);
[52070] Fix | Delete
const isFocusedWithin = () => {
[52071] Fix | Delete
return ref?.current && ref.current.contains(ref.current.ownerDocument.activeElement);
[52072] Fix | Delete
};
[52073] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[52074] Fix | Delete
const node = ref.current;
[52075] Fix | Delete
const handleOnFocus = () => {
[52076] Fix | Delete
if (isFocusedWithin()) {
[52077] Fix | Delete
setIsFocused(true);
[52078] Fix | Delete
debouncedShowGestures();
[52079] Fix | Delete
}
[52080] Fix | Delete
};
[52081] Fix | Delete
const handleOnBlur = () => {
[52082] Fix | Delete
if (!isFocusedWithin()) {
[52083] Fix | Delete
setIsFocused(false);
[52084] Fix | Delete
debouncedHideGestures();
[52085] Fix | Delete
}
[52086] Fix | Delete
};
[52087] Fix | Delete
[52088] Fix | Delete
/**
[52089] Fix | Delete
* Events are added via DOM events (vs. React synthetic events),
[52090] Fix | Delete
* as the child React components swallow mouse events.
[52091] Fix | Delete
*/
[52092] Fix | Delete
if (node && !registerRef.current) {
[52093] Fix | Delete
node.addEventListener('focus', handleOnFocus, true);
[52094] Fix | Delete
node.addEventListener('blur', handleOnBlur, true);
[52095] Fix | Delete
registerRef.current = true;
[52096] Fix | Delete
}
[52097] Fix | Delete
return () => {
[52098] Fix | Delete
if (node) {
[52099] Fix | Delete
node.removeEventListener('focus', handleOnFocus);
[52100] Fix | Delete
node.removeEventListener('blur', handleOnBlur);
[52101] Fix | Delete
}
[52102] Fix | Delete
};
[52103] Fix | Delete
}, [ref, registerRef, setIsFocused, debouncedShowGestures, debouncedHideGestures]);
[52104] Fix | Delete
return {
[52105] Fix | Delete
onMouseMove: debouncedShowGestures,
[52106] Fix | Delete
onMouseLeave: debouncedHideGestures
[52107] Fix | Delete
};
[52108] Fix | Delete
}
[52109] Fix | Delete
[52110] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js
[52111] Fix | Delete
/**
[52112] Fix | Delete
* WordPress dependencies
[52113] Fix | Delete
*/
[52114] Fix | Delete
[52115] Fix | Delete
[52116] Fix | Delete
[52117] Fix | Delete
[52118] Fix | Delete
[52119] Fix | Delete
[52120] Fix | Delete
/**
[52121] Fix | Delete
* Internal dependencies
[52122] Fix | Delete
*/
[52123] Fix | Delete
[52124] Fix | Delete
[52125] Fix | Delete
[52126] Fix | Delete
[52127] Fix | Delete
[52128] Fix | Delete
/**
[52129] Fix | Delete
* Block parent selector component, displaying the hierarchy of the
[52130] Fix | Delete
* current block selection as a single icon to "go up" a level.
[52131] Fix | Delete
*
[52132] Fix | Delete
* @return {Component} Parent block selector.
[52133] Fix | Delete
*/
[52134] Fix | Delete
[52135] Fix | Delete
function BlockParentSelector() {
[52136] Fix | Delete
const {
[52137] Fix | Delete
selectBlock
[52138] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[52139] Fix | Delete
const {
[52140] Fix | Delete
firstParentClientId,
[52141] Fix | Delete
isVisible
[52142] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[52143] Fix | Delete
const {
[52144] Fix | Delete
getBlockName,
[52145] Fix | Delete
getBlockParents,
[52146] Fix | Delete
getSelectedBlockClientId,
[52147] Fix | Delete
getBlockEditingMode
[52148] Fix | Delete
} = select(store);
[52149] Fix | Delete
const {
[52150] Fix | Delete
hasBlockSupport
[52151] Fix | Delete
} = select(external_wp_blocks_namespaceObject.store);
[52152] Fix | Delete
const selectedBlockClientId = getSelectedBlockClientId();
[52153] Fix | Delete
const parents = getBlockParents(selectedBlockClientId);
[52154] Fix | Delete
const _firstParentClientId = parents[parents.length - 1];
[52155] Fix | Delete
const parentBlockName = getBlockName(_firstParentClientId);
[52156] Fix | Delete
const _parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName);
[52157] Fix | Delete
return {
[52158] Fix | Delete
firstParentClientId: _firstParentClientId,
[52159] Fix | Delete
isVisible: _firstParentClientId && getBlockEditingMode(_firstParentClientId) === 'default' && hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true)
[52160] Fix | Delete
};
[52161] Fix | Delete
}, []);
[52162] Fix | Delete
const blockInformation = useBlockDisplayInformation(firstParentClientId);
[52163] Fix | Delete
[52164] Fix | Delete
// Allows highlighting the parent block outline when focusing or hovering
[52165] Fix | Delete
// the parent block selector within the child.
[52166] Fix | Delete
const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
[52167] Fix | Delete
const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({
[52168] Fix | Delete
ref: nodeRef,
[52169] Fix | Delete
highlightParent: true
[52170] Fix | Delete
});
[52171] Fix | Delete
if (!isVisible) {
[52172] Fix | Delete
return null;
[52173] Fix | Delete
}
[52174] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[52175] Fix | Delete
className: "block-editor-block-parent-selector",
[52176] Fix | Delete
ref: nodeRef,
[52177] Fix | Delete
...showHoveredOrFocusedGestures,
[52178] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
[52179] Fix | Delete
className: "block-editor-block-parent-selector__button",
[52180] Fix | Delete
onClick: () => selectBlock(firstParentClientId),
[52181] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */
[52182] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Select parent block: %s'), blockInformation?.title),
[52183] Fix | Delete
showTooltip: true,
[52184] Fix | Delete
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, {
[52185] Fix | Delete
icon: blockInformation?.icon
[52186] Fix | Delete
})
[52187] Fix | Delete
})
[52188] Fix | Delete
}, firstParentClientId);
[52189] Fix | Delete
}
[52190] Fix | Delete
[52191] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js
[52192] Fix | Delete
/**
[52193] Fix | Delete
* WordPress dependencies
[52194] Fix | Delete
*/
[52195] Fix | Delete
[52196] Fix | Delete
[52197] Fix | Delete
const copy_copy = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[52198] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[52199] Fix | Delete
viewBox: "0 0 24 24",
[52200] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[52201] Fix | Delete
fillRule: "evenodd",
[52202] Fix | Delete
clipRule: "evenodd",
[52203] Fix | Delete
d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
[52204] Fix | Delete
})
[52205] Fix | Delete
});
[52206] Fix | Delete
/* harmony default export */ const library_copy = (copy_copy);
[52207] Fix | Delete
[52208] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js
[52209] Fix | Delete
/**
[52210] Fix | Delete
* WordPress dependencies
[52211] Fix | Delete
*/
[52212] Fix | Delete
[52213] Fix | Delete
[52214] Fix | Delete
[52215] Fix | Delete
/**
[52216] Fix | Delete
* Internal dependencies
[52217] Fix | Delete
*/
[52218] Fix | Delete
[52219] Fix | Delete
[52220] Fix | Delete
[52221] Fix | Delete
function PreviewBlockPopover({
[52222] Fix | Delete
blocks
[52223] Fix | Delete
}) {
[52224] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[52225] Fix | Delete
className: "block-editor-block-switcher__popover__preview__parent",
[52226] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[52227] Fix | Delete
className: "block-editor-block-switcher__popover__preview__container",
[52228] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
[52229] Fix | Delete
className: "block-editor-block-switcher__preview__popover",
[52230] Fix | Delete
placement: "bottom-start",
[52231] Fix | Delete
focusOnMount: false,
[52232] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[52233] Fix | Delete
className: "block-editor-block-switcher__preview",
[52234] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[52235] Fix | Delete
className: "block-editor-block-switcher__preview-title",
[52236] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Preview')
[52237] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, {
[52238] Fix | Delete
viewportWidth: 500,
[52239] Fix | Delete
blocks: blocks
[52240] Fix | Delete
})]
[52241] Fix | Delete
})
[52242] Fix | Delete
})
[52243] Fix | Delete
})
[52244] Fix | Delete
});
[52245] Fix | Delete
}
[52246] Fix | Delete
[52247] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js
[52248] Fix | Delete
/**
[52249] Fix | Delete
* WordPress dependencies
[52250] Fix | Delete
*/
[52251] Fix | Delete
[52252] Fix | Delete
[52253] Fix | Delete
[52254] Fix | Delete
[52255] Fix | Delete
[52256] Fix | Delete
/**
[52257] Fix | Delete
* Internal dependencies
[52258] Fix | Delete
*/
[52259] Fix | Delete
[52260] Fix | Delete
[52261] Fix | Delete
[52262] Fix | Delete
[52263] Fix | Delete
[52264] Fix | Delete
[52265] Fix | Delete
const block_variation_transformations_EMPTY_OBJECT = {};
[52266] Fix | Delete
function useBlockVariationTransforms({
[52267] Fix | Delete
clientIds,
[52268] Fix | Delete
blocks
[52269] Fix | Delete
}) {
[52270] Fix | Delete
const {
[52271] Fix | Delete
activeBlockVariation,
[52272] Fix | Delete
blockVariationTransformations
[52273] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[52274] Fix | Delete
const {
[52275] Fix | Delete
getBlockAttributes,
[52276] Fix | Delete
canRemoveBlocks
[52277] Fix | Delete
} = select(store);
[52278] Fix | Delete
const {
[52279] Fix | Delete
getActiveBlockVariation,
[52280] Fix | Delete
getBlockVariations
[52281] Fix | Delete
} = select(external_wp_blocks_namespaceObject.store);
[52282] Fix | Delete
const canRemove = canRemoveBlocks(clientIds);
[52283] Fix | Delete
// Only handle single selected blocks for now.
[52284] Fix | Delete
if (blocks.length !== 1 || !canRemove) {
[52285] Fix | Delete
return block_variation_transformations_EMPTY_OBJECT;
[52286] Fix | Delete
}
[52287] Fix | Delete
const [firstBlock] = blocks;
[52288] Fix | Delete
return {
[52289] Fix | Delete
blockVariationTransformations: getBlockVariations(firstBlock.name, 'transform'),
[52290] Fix | Delete
activeBlockVariation: getActiveBlockVariation(firstBlock.name, getBlockAttributes(firstBlock.clientId))
[52291] Fix | Delete
};
[52292] Fix | Delete
}, [clientIds, blocks]);
[52293] Fix | Delete
const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
[52294] Fix | Delete
return blockVariationTransformations?.filter(({
[52295] Fix | Delete
name
[52296] Fix | Delete
}) => name !== activeBlockVariation?.name);
[52297] Fix | Delete
}, [blockVariationTransformations, activeBlockVariation]);
[52298] Fix | Delete
return transformations;
[52299] Fix | Delete
}
[52300] Fix | Delete
const BlockVariationTransformations = ({
[52301] Fix | Delete
transformations,
[52302] Fix | Delete
onSelect,
[52303] Fix | Delete
blocks
[52304] Fix | Delete
}) => {
[52305] Fix | Delete
const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
[52306] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[52307] Fix | Delete
children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, {
[52308] Fix | Delete
blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(blocks[0], transformations.find(({
[52309] Fix | Delete
name
[52310] Fix | Delete
}) => name === hoveredTransformItemName).attributes)
[52311] Fix | Delete
}), transformations?.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVariationTranformationItem, {
[52312] Fix | Delete
item: item,
[52313] Fix | Delete
onSelect: onSelect,
[52314] Fix | Delete
setHoveredTransformItemName: setHoveredTransformItemName
[52315] Fix | Delete
}, item.name))]
[52316] Fix | Delete
});
[52317] Fix | Delete
};
[52318] Fix | Delete
function BlockVariationTranformationItem({
[52319] Fix | Delete
item,
[52320] Fix | Delete
onSelect,
[52321] Fix | Delete
setHoveredTransformItemName
[52322] Fix | Delete
}) {
[52323] Fix | Delete
const {
[52324] Fix | Delete
name,
[52325] Fix | Delete
icon,
[52326] Fix | Delete
title
[52327] Fix | Delete
} = item;
[52328] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, {
[52329] Fix | Delete
className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
[52330] Fix | Delete
onClick: event => {
[52331] Fix | Delete
event.preventDefault();
[52332] Fix | Delete
onSelect(name);
[52333] Fix | Delete
},
[52334] Fix | Delete
onMouseLeave: () => setHoveredTransformItemName(null),
[52335] Fix | Delete
onMouseEnter: () => setHoveredTransformItemName(name),
[52336] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, {
[52337] Fix | Delete
icon: icon,
[52338] Fix | Delete
showColors: true
[52339] Fix | Delete
}), title]
[52340] Fix | Delete
});
[52341] Fix | Delete
}
[52342] Fix | Delete
/* harmony default export */ const block_variation_transformations = (BlockVariationTransformations);
[52343] Fix | Delete
[52344] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js
[52345] Fix | Delete
/**
[52346] Fix | Delete
* WordPress dependencies
[52347] Fix | Delete
*/
[52348] Fix | Delete
[52349] Fix | Delete
[52350] Fix | Delete
[52351] Fix | Delete
[52352] Fix | Delete
[52353] Fix | Delete
/**
[52354] Fix | Delete
* Internal dependencies
[52355] Fix | Delete
*/
[52356] Fix | Delete
[52357] Fix | Delete
[52358] Fix | Delete
[52359] Fix | Delete
[52360] Fix | Delete
/**
[52361] Fix | Delete
* Helper hook to group transformations to display them in a specific order in the UI.
[52362] Fix | Delete
* For now we group only priority content driven transformations(ex. paragraph -> heading).
[52363] Fix | Delete
*
[52364] Fix | Delete
* Later on we could also group 'layout' transformations(ex. paragraph -> group) and
[52365] Fix | Delete
* display them in different sections.
[52366] Fix | Delete
*
[52367] Fix | Delete
* @param {Object[]} possibleBlockTransformations The available block transformations.
[52368] Fix | Delete
* @return {Record<string, Object[]>} The grouped block transformations.
[52369] Fix | Delete
*/
[52370] Fix | Delete
[52371] Fix | Delete
[52372] Fix | Delete
[52373] Fix | Delete
function useGroupedTransforms(possibleBlockTransformations) {
[52374] Fix | Delete
const priorityContentTranformationBlocks = {
[52375] Fix | Delete
'core/paragraph': 1,
[52376] Fix | Delete
'core/heading': 2,
[52377] Fix | Delete
'core/list': 3,
[52378] Fix | Delete
'core/quote': 4
[52379] Fix | Delete
};
[52380] Fix | Delete
const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
[52381] Fix | Delete
const priorityTextTranformsNames = Object.keys(priorityContentTranformationBlocks);
[52382] Fix | Delete
const groupedPossibleTransforms = possibleBlockTransformations.reduce((accumulator, item) => {
[52383] Fix | Delete
const {
[52384] Fix | Delete
name
[52385] Fix | Delete
} = item;
[52386] Fix | Delete
if (priorityTextTranformsNames.includes(name)) {
[52387] Fix | Delete
accumulator.priorityTextTransformations.push(item);
[52388] Fix | Delete
} else {
[52389] Fix | Delete
accumulator.restTransformations.push(item);
[52390] Fix | Delete
}
[52391] Fix | Delete
return accumulator;
[52392] Fix | Delete
}, {
[52393] Fix | Delete
priorityTextTransformations: [],
[52394] Fix | Delete
restTransformations: []
[52395] Fix | Delete
});
[52396] Fix | Delete
/**
[52397] Fix | Delete
* If there is only one priority text transformation and it's a Quote,
[52398] Fix | Delete
* is should move to the rest transformations. This is because Quote can
[52399] Fix | Delete
* be a container for any block type, so in multi-block selection it will
[52400] Fix | Delete
* always be suggested, even for non-text blocks.
[52401] Fix | Delete
*/
[52402] Fix | Delete
if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === 'core/quote') {
[52403] Fix | Delete
const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop();
[52404] Fix | Delete
groupedPossibleTransforms.restTransformations.push(singleQuote);
[52405] Fix | Delete
}
[52406] Fix | Delete
return groupedPossibleTransforms;
[52407] Fix | Delete
}, [possibleBlockTransformations]);
[52408] Fix | Delete
[52409] Fix | Delete
// Order the priority text transformations.
[52410] Fix | Delete
transformations.priorityTextTransformations.sort(({
[52411] Fix | Delete
name: currentName
[52412] Fix | Delete
}, {
[52413] Fix | Delete
name: nextName
[52414] Fix | Delete
}) => {
[52415] Fix | Delete
return priorityContentTranformationBlocks[currentName] < priorityContentTranformationBlocks[nextName] ? -1 : 1;
[52416] Fix | Delete
});
[52417] Fix | Delete
return transformations;
[52418] Fix | Delete
}
[52419] Fix | Delete
const BlockTransformationsMenu = ({
[52420] Fix | Delete
className,
[52421] Fix | Delete
possibleBlockTransformations,
[52422] Fix | Delete
possibleBlockVariationTransformations,
[52423] Fix | Delete
onSelect,
[52424] Fix | Delete
onSelectVariation,
[52425] Fix | Delete
blocks
[52426] Fix | Delete
}) => {
[52427] Fix | Delete
const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
[52428] Fix | Delete
const {
[52429] Fix | Delete
priorityTextTransformations,
[52430] Fix | Delete
restTransformations
[52431] Fix | Delete
} = useGroupedTransforms(possibleBlockTransformations);
[52432] Fix | Delete
// We have to check if both content transformations(priority and rest) are set
[52433] Fix | Delete
// in order to create a separate MenuGroup for them.
[52434] Fix | Delete
const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length;
[52435] Fix | Delete
const restTransformItems = !!restTransformations.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RestTransformationItems, {
[52436] Fix | Delete
restTransformations: restTransformations,
[52437] Fix | Delete
onSelect: onSelect,
[52438] Fix | Delete
setHoveredTransformItemName: setHoveredTransformItemName
[52439] Fix | Delete
});
[52440] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[52441] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
[52442] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Transform to'),
[52443] Fix | Delete
className: className,
[52444] Fix | Delete
children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, {
[52445] Fix | Delete
blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName)
[52446] Fix | Delete
}), !!possibleBlockVariationTransformations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transformations, {
[52447] Fix | Delete
transformations: possibleBlockVariationTransformations,
[52448] Fix | Delete
blocks: blocks,
[52449] Fix | Delete
onSelect: onSelectVariation
[52450] Fix | Delete
}), priorityTextTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTranformationItem, {
[52451] Fix | Delete
item: item,
[52452] Fix | Delete
onSelect: onSelect,
[52453] Fix | Delete
setHoveredTransformItemName: setHoveredTransformItemName
[52454] Fix | Delete
}, item.name)), !hasBothContentTransformations && restTransformItems]
[52455] Fix | Delete
}), !!hasBothContentTransformations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
[52456] Fix | Delete
className: className,
[52457] Fix | Delete
children: restTransformItems
[52458] Fix | Delete
})]
[52459] Fix | Delete
});
[52460] Fix | Delete
};
[52461] Fix | Delete
function RestTransformationItems({
[52462] Fix | Delete
restTransformations,
[52463] Fix | Delete
onSelect,
[52464] Fix | Delete
setHoveredTransformItemName
[52465] Fix | Delete
}) {
[52466] Fix | Delete
return restTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTranformationItem, {
[52467] Fix | Delete
item: item,
[52468] Fix | Delete
onSelect: onSelect,
[52469] Fix | Delete
setHoveredTransformItemName: setHoveredTransformItemName
[52470] Fix | Delete
}, item.name));
[52471] Fix | Delete
}
[52472] Fix | Delete
function BlockTranformationItem({
[52473] Fix | Delete
item,
[52474] Fix | Delete
onSelect,
[52475] Fix | Delete
setHoveredTransformItemName
[52476] Fix | Delete
}) {
[52477] Fix | Delete
const {
[52478] Fix | Delete
name,
[52479] Fix | Delete
icon,
[52480] Fix | Delete
title,
[52481] Fix | Delete
isDisabled
[52482] Fix | Delete
} = item;
[52483] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, {
[52484] Fix | Delete
className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
[52485] Fix | Delete
onClick: event => {
[52486] Fix | Delete
event.preventDefault();
[52487] Fix | Delete
onSelect(name);
[52488] Fix | Delete
},
[52489] Fix | Delete
disabled: isDisabled,
[52490] Fix | Delete
onMouseLeave: () => setHoveredTransformItemName(null),
[52491] Fix | Delete
onMouseEnter: () => setHoveredTransformItemName(name),
[52492] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, {
[52493] Fix | Delete
icon: icon,
[52494] Fix | Delete
showColors: true
[52495] Fix | Delete
}), title]
[52496] Fix | Delete
});
[52497] Fix | Delete
}
[52498] Fix | Delete
/* harmony default export */ const block_transformations_menu = (BlockTransformationsMenu);
[52499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function