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: editor.js
*
[9500] Fix | Delete
* The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.
[9501] Fix | Delete
*
[9502] Fix | Delete
* @module LocalAutosaveMonitor
[9503] Fix | Delete
*/
[9504] Fix | Delete
/* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
[9505] Fix | Delete
[9506] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
[9507] Fix | Delete
/**
[9508] Fix | Delete
* WordPress dependencies
[9509] Fix | Delete
*/
[9510] Fix | Delete
[9511] Fix | Delete
[9512] Fix | Delete
[9513] Fix | Delete
/**
[9514] Fix | Delete
* Internal dependencies
[9515] Fix | Delete
*/
[9516] Fix | Delete
[9517] Fix | Delete
[9518] Fix | Delete
/**
[9519] Fix | Delete
* Wrapper component that renders its children only if the post type supports page attributes.
[9520] Fix | Delete
*
[9521] Fix | Delete
* @param {Object} props - The component props.
[9522] Fix | Delete
* @param {Element} props.children - The child components to render.
[9523] Fix | Delete
*
[9524] Fix | Delete
* @return {Component|null} The rendered child components or null if page attributes are not supported.
[9525] Fix | Delete
*/
[9526] Fix | Delete
function PageAttributesCheck({
[9527] Fix | Delete
children
[9528] Fix | Delete
}) {
[9529] Fix | Delete
const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => {
[9530] Fix | Delete
const {
[9531] Fix | Delete
getEditedPostAttribute
[9532] Fix | Delete
} = select(store_store);
[9533] Fix | Delete
const {
[9534] Fix | Delete
getPostType
[9535] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[9536] Fix | Delete
const postType = getPostType(getEditedPostAttribute('type'));
[9537] Fix | Delete
return !!postType?.supports?.['page-attributes'];
[9538] Fix | Delete
}, []);
[9539] Fix | Delete
[9540] Fix | Delete
// Only render fields if post type supports page attributes or available templates exist.
[9541] Fix | Delete
if (!supportsPageAttributes) {
[9542] Fix | Delete
return null;
[9543] Fix | Delete
}
[9544] Fix | Delete
return children;
[9545] Fix | Delete
}
[9546] Fix | Delete
/* harmony default export */ const page_attributes_check = (PageAttributesCheck);
[9547] Fix | Delete
[9548] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js
[9549] Fix | Delete
/**
[9550] Fix | Delete
* External dependencies
[9551] Fix | Delete
*/
[9552] Fix | Delete
[9553] Fix | Delete
[9554] Fix | Delete
/**
[9555] Fix | Delete
* WordPress dependencies
[9556] Fix | Delete
*/
[9557] Fix | Delete
[9558] Fix | Delete
[9559] Fix | Delete
[9560] Fix | Delete
[9561] Fix | Delete
const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({
[9562] Fix | Delete
className,
[9563] Fix | Delete
label,
[9564] Fix | Delete
children
[9565] Fix | Delete
}, ref) => {
[9566] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[9567] Fix | Delete
className: dist_clsx('editor-post-panel__row', className),
[9568] Fix | Delete
ref: ref,
[9569] Fix | Delete
children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[9570] Fix | Delete
className: "editor-post-panel__row-label",
[9571] Fix | Delete
children: label
[9572] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[9573] Fix | Delete
className: "editor-post-panel__row-control",
[9574] Fix | Delete
children: children
[9575] Fix | Delete
})]
[9576] Fix | Delete
});
[9577] Fix | Delete
});
[9578] Fix | Delete
/* harmony default export */ const post_panel_row = (PostPanelRow);
[9579] Fix | Delete
[9580] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
[9581] Fix | Delete
/**
[9582] Fix | Delete
* WordPress dependencies
[9583] Fix | Delete
*/
[9584] Fix | Delete
[9585] Fix | Delete
[9586] Fix | Delete
[9587] Fix | Delete
/**
[9588] Fix | Delete
* Internal dependencies
[9589] Fix | Delete
*/
[9590] Fix | Delete
[9591] Fix | Delete
[9592] Fix | Delete
/**
[9593] Fix | Delete
* A component which renders its own children only if the current editor post
[9594] Fix | Delete
* type supports one of the given `supportKeys` prop.
[9595] Fix | Delete
*
[9596] Fix | Delete
* @param {Object} props Props.
[9597] Fix | Delete
* @param {Element} props.children Children to be rendered if post
[9598] Fix | Delete
* type supports.
[9599] Fix | Delete
* @param {(string|string[])} props.supportKeys String or string array of keys
[9600] Fix | Delete
* to test.
[9601] Fix | Delete
*
[9602] Fix | Delete
* @return {Component} The component to be rendered.
[9603] Fix | Delete
*/
[9604] Fix | Delete
function PostTypeSupportCheck({
[9605] Fix | Delete
children,
[9606] Fix | Delete
supportKeys
[9607] Fix | Delete
}) {
[9608] Fix | Delete
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
[9609] Fix | Delete
const {
[9610] Fix | Delete
getEditedPostAttribute
[9611] Fix | Delete
} = select(store_store);
[9612] Fix | Delete
const {
[9613] Fix | Delete
getPostType
[9614] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[9615] Fix | Delete
return getPostType(getEditedPostAttribute('type'));
[9616] Fix | Delete
}, []);
[9617] Fix | Delete
let isSupported = !!postType;
[9618] Fix | Delete
if (postType) {
[9619] Fix | Delete
isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]);
[9620] Fix | Delete
}
[9621] Fix | Delete
if (!isSupported) {
[9622] Fix | Delete
return null;
[9623] Fix | Delete
}
[9624] Fix | Delete
return children;
[9625] Fix | Delete
}
[9626] Fix | Delete
/* harmony default export */ const post_type_support_check = (PostTypeSupportCheck);
[9627] Fix | Delete
[9628] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
[9629] Fix | Delete
/**
[9630] Fix | Delete
* WordPress dependencies
[9631] Fix | Delete
*/
[9632] Fix | Delete
[9633] Fix | Delete
[9634] Fix | Delete
[9635] Fix | Delete
[9636] Fix | Delete
[9637] Fix | Delete
[9638] Fix | Delete
/**
[9639] Fix | Delete
* Internal dependencies
[9640] Fix | Delete
*/
[9641] Fix | Delete
[9642] Fix | Delete
[9643] Fix | Delete
[9644] Fix | Delete
[9645] Fix | Delete
[9646] Fix | Delete
function PageAttributesOrder() {
[9647] Fix | Delete
const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
[9648] Fix | Delete
var _select$getEditedPost;
[9649] Fix | Delete
return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0;
[9650] Fix | Delete
}, []);
[9651] Fix | Delete
const {
[9652] Fix | Delete
editPost
[9653] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[9654] Fix | Delete
const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null);
[9655] Fix | Delete
const setUpdatedOrder = value => {
[9656] Fix | Delete
setOrderInput(value);
[9657] Fix | Delete
const newOrder = Number(value);
[9658] Fix | Delete
if (Number.isInteger(newOrder) && value.trim?.() !== '') {
[9659] Fix | Delete
editPost({
[9660] Fix | Delete
menu_order: newOrder
[9661] Fix | Delete
});
[9662] Fix | Delete
}
[9663] Fix | Delete
};
[9664] Fix | Delete
const value = orderInput !== null && orderInput !== void 0 ? orderInput : order;
[9665] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
[9666] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
[9667] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
[9668] Fix | Delete
__next40pxDefaultSize: true,
[9669] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Order'),
[9670] Fix | Delete
help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'),
[9671] Fix | Delete
value: value,
[9672] Fix | Delete
onChange: setUpdatedOrder,
[9673] Fix | Delete
hideLabelFromVision: true,
[9674] Fix | Delete
onBlur: () => {
[9675] Fix | Delete
setOrderInput(null);
[9676] Fix | Delete
}
[9677] Fix | Delete
})
[9678] Fix | Delete
})
[9679] Fix | Delete
});
[9680] Fix | Delete
}
[9681] Fix | Delete
[9682] Fix | Delete
/**
[9683] Fix | Delete
* Renders the Page Attributes Order component. A number input in an editor interface
[9684] Fix | Delete
* for setting the order of a given page.
[9685] Fix | Delete
*
[9686] Fix | Delete
* @return {Component} The component to be rendered.
[9687] Fix | Delete
*/
[9688] Fix | Delete
function PageAttributesOrderWithChecks() {
[9689] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
[9690] Fix | Delete
supportKeys: "page-attributes",
[9691] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {})
[9692] Fix | Delete
});
[9693] Fix | Delete
}
[9694] Fix | Delete
function PostOrderToggle({
[9695] Fix | Delete
isOpen,
[9696] Fix | Delete
onClick
[9697] Fix | Delete
}) {
[9698] Fix | Delete
const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
[9699] Fix | Delete
var _select$getEditedPost2;
[9700] Fix | Delete
return (_select$getEditedPost2 = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost2 !== void 0 ? _select$getEditedPost2 : 0;
[9701] Fix | Delete
}, []);
[9702] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[9703] Fix | Delete
size: "compact",
[9704] Fix | Delete
className: "editor-post-order__panel-toggle",
[9705] Fix | Delete
variant: "tertiary",
[9706] Fix | Delete
"aria-expanded": isOpen
[9707] Fix | Delete
// translators: %s: Current post parent.
[9708] Fix | Delete
,
[9709] Fix | Delete
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change order: %s'), order),
[9710] Fix | Delete
onClick: onClick,
[9711] Fix | Delete
children: order
[9712] Fix | Delete
});
[9713] Fix | Delete
}
[9714] Fix | Delete
function OrderRow() {
[9715] Fix | Delete
// Use internal state instead of a ref to make sure that the component
[9716] Fix | Delete
// re-renders when the popover's anchor updates.
[9717] Fix | Delete
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
[9718] Fix | Delete
// Memoize popoverProps to avoid returning a new object every time.
[9719] Fix | Delete
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
[9720] Fix | Delete
// Anchor the popover to the middle of the entire row so that it doesn't
[9721] Fix | Delete
// move around when the label changes.
[9722] Fix | Delete
anchor: popoverAnchor,
[9723] Fix | Delete
placement: 'left-start',
[9724] Fix | Delete
offset: 36,
[9725] Fix | Delete
shift: true
[9726] Fix | Delete
}), [popoverAnchor]);
[9727] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
[9728] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Order'),
[9729] Fix | Delete
ref: setPopoverAnchor,
[9730] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
[9731] Fix | Delete
popoverProps: popoverProps,
[9732] Fix | Delete
className: "editor-post-order__panel-dropdown",
[9733] Fix | Delete
contentClassName: "editor-post-order__panel-dialog",
[9734] Fix | Delete
focusOnMount: true,
[9735] Fix | Delete
renderToggle: ({
[9736] Fix | Delete
isOpen,
[9737] Fix | Delete
onToggle
[9738] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostOrderToggle, {
[9739] Fix | Delete
isOpen: isOpen,
[9740] Fix | Delete
onClick: onToggle
[9741] Fix | Delete
}),
[9742] Fix | Delete
renderContent: ({
[9743] Fix | Delete
onClose
[9744] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[9745] Fix | Delete
className: "editor-post-order",
[9746] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
[9747] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Order'),
[9748] Fix | Delete
onClose: onClose
[9749] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[9750] Fix | Delete
children: [(0,external_wp_i18n_namespaceObject.__)('This attribute determines the order of pages in the Pages List block.'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[9751] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Pages with the same order value will sorted alphabetically. Negative order values are also supported.')
[9752] Fix | Delete
})]
[9753] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {})]
[9754] Fix | Delete
})
[9755] Fix | Delete
})
[9756] Fix | Delete
});
[9757] Fix | Delete
}
[9758] Fix | Delete
[9759] Fix | Delete
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
[9760] Fix | Delete
var remove_accents = __webpack_require__(9681);
[9761] Fix | Delete
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
[9762] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
[9763] Fix | Delete
/**
[9764] Fix | Delete
* WordPress dependencies
[9765] Fix | Delete
*/
[9766] Fix | Delete
[9767] Fix | Delete
[9768] Fix | Delete
/**
[9769] Fix | Delete
* Returns terms in a tree form.
[9770] Fix | Delete
*
[9771] Fix | Delete
* @param {Array} flatTerms Array of terms in flat format.
[9772] Fix | Delete
*
[9773] Fix | Delete
* @return {Array} Array of terms in tree format.
[9774] Fix | Delete
*/
[9775] Fix | Delete
function buildTermsTree(flatTerms) {
[9776] Fix | Delete
const flatTermsWithParentAndChildren = flatTerms.map(term => {
[9777] Fix | Delete
return {
[9778] Fix | Delete
children: [],
[9779] Fix | Delete
parent: null,
[9780] Fix | Delete
...term
[9781] Fix | Delete
};
[9782] Fix | Delete
});
[9783] Fix | Delete
[9784] Fix | Delete
// All terms should have a `parent` because we're about to index them by it.
[9785] Fix | Delete
if (flatTermsWithParentAndChildren.some(({
[9786] Fix | Delete
parent
[9787] Fix | Delete
}) => parent === null)) {
[9788] Fix | Delete
return flatTermsWithParentAndChildren;
[9789] Fix | Delete
}
[9790] Fix | Delete
const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
[9791] Fix | Delete
const {
[9792] Fix | Delete
parent
[9793] Fix | Delete
} = term;
[9794] Fix | Delete
if (!acc[parent]) {
[9795] Fix | Delete
acc[parent] = [];
[9796] Fix | Delete
}
[9797] Fix | Delete
acc[parent].push(term);
[9798] Fix | Delete
return acc;
[9799] Fix | Delete
}, {});
[9800] Fix | Delete
const fillWithChildren = terms => {
[9801] Fix | Delete
return terms.map(term => {
[9802] Fix | Delete
const children = termsByParent[term.id];
[9803] Fix | Delete
return {
[9804] Fix | Delete
...term,
[9805] Fix | Delete
children: children && children.length ? fillWithChildren(children) : []
[9806] Fix | Delete
};
[9807] Fix | Delete
});
[9808] Fix | Delete
};
[9809] Fix | Delete
return fillWithChildren(termsByParent['0'] || []);
[9810] Fix | Delete
}
[9811] Fix | Delete
const unescapeString = arg => {
[9812] Fix | Delete
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg);
[9813] Fix | Delete
};
[9814] Fix | Delete
[9815] Fix | Delete
/**
[9816] Fix | Delete
* Returns a term object with name unescaped.
[9817] Fix | Delete
*
[9818] Fix | Delete
* @param {Object} term The term object to unescape.
[9819] Fix | Delete
*
[9820] Fix | Delete
* @return {Object} Term object with name property unescaped.
[9821] Fix | Delete
*/
[9822] Fix | Delete
const unescapeTerm = term => {
[9823] Fix | Delete
return {
[9824] Fix | Delete
...term,
[9825] Fix | Delete
name: unescapeString(term.name)
[9826] Fix | Delete
};
[9827] Fix | Delete
};
[9828] Fix | Delete
[9829] Fix | Delete
/**
[9830] Fix | Delete
* Returns an array of term objects with names unescaped.
[9831] Fix | Delete
* The unescape of each term is performed using the unescapeTerm function.
[9832] Fix | Delete
*
[9833] Fix | Delete
* @param {Object[]} terms Array of term objects to unescape.
[9834] Fix | Delete
*
[9835] Fix | Delete
* @return {Object[]} Array of term objects unescaped.
[9836] Fix | Delete
*/
[9837] Fix | Delete
const unescapeTerms = terms => {
[9838] Fix | Delete
return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm);
[9839] Fix | Delete
};
[9840] Fix | Delete
[9841] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
[9842] Fix | Delete
/**
[9843] Fix | Delete
* External dependencies
[9844] Fix | Delete
*/
[9845] Fix | Delete
[9846] Fix | Delete
[9847] Fix | Delete
/**
[9848] Fix | Delete
* WordPress dependencies
[9849] Fix | Delete
*/
[9850] Fix | Delete
[9851] Fix | Delete
[9852] Fix | Delete
[9853] Fix | Delete
[9854] Fix | Delete
[9855] Fix | Delete
[9856] Fix | Delete
[9857] Fix | Delete
[9858] Fix | Delete
[9859] Fix | Delete
/**
[9860] Fix | Delete
* Internal dependencies
[9861] Fix | Delete
*/
[9862] Fix | Delete
[9863] Fix | Delete
[9864] Fix | Delete
[9865] Fix | Delete
[9866] Fix | Delete
[9867] Fix | Delete
function getTitle(post) {
[9868] Fix | Delete
return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
[9869] Fix | Delete
}
[9870] Fix | Delete
const getItemPriority = (name, searchValue) => {
[9871] Fix | Delete
const normalizedName = remove_accents_default()(name || '').toLowerCase();
[9872] Fix | Delete
const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase();
[9873] Fix | Delete
if (normalizedName === normalizedSearch) {
[9874] Fix | Delete
return 0;
[9875] Fix | Delete
}
[9876] Fix | Delete
if (normalizedName.startsWith(normalizedSearch)) {
[9877] Fix | Delete
return normalizedName.length;
[9878] Fix | Delete
}
[9879] Fix | Delete
return Infinity;
[9880] Fix | Delete
};
[9881] Fix | Delete
[9882] Fix | Delete
/**
[9883] Fix | Delete
* Renders the Page Attributes Parent component. A dropdown menu in an editor interface
[9884] Fix | Delete
* for selecting the parent page of a given page.
[9885] Fix | Delete
*
[9886] Fix | Delete
* @return {Component|null} The component to be rendered. Return null if post type is not hierarchical.
[9887] Fix | Delete
*/
[9888] Fix | Delete
function PageAttributesParent() {
[9889] Fix | Delete
const {
[9890] Fix | Delete
editPost
[9891] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[9892] Fix | Delete
const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false);
[9893] Fix | Delete
const {
[9894] Fix | Delete
isHierarchical,
[9895] Fix | Delete
parentPostId,
[9896] Fix | Delete
parentPostTitle,
[9897] Fix | Delete
pageItems
[9898] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[9899] Fix | Delete
var _pType$hierarchical;
[9900] Fix | Delete
const {
[9901] Fix | Delete
getPostType,
[9902] Fix | Delete
getEntityRecords,
[9903] Fix | Delete
getEntityRecord
[9904] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[9905] Fix | Delete
const {
[9906] Fix | Delete
getCurrentPostId,
[9907] Fix | Delete
getEditedPostAttribute
[9908] Fix | Delete
} = select(store_store);
[9909] Fix | Delete
const postTypeSlug = getEditedPostAttribute('type');
[9910] Fix | Delete
const pageId = getEditedPostAttribute('parent');
[9911] Fix | Delete
const pType = getPostType(postTypeSlug);
[9912] Fix | Delete
const postId = getCurrentPostId();
[9913] Fix | Delete
const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false;
[9914] Fix | Delete
const query = {
[9915] Fix | Delete
per_page: 100,
[9916] Fix | Delete
exclude: postId,
[9917] Fix | Delete
parent_exclude: postId,
[9918] Fix | Delete
orderby: 'menu_order',
[9919] Fix | Delete
order: 'asc',
[9920] Fix | Delete
_fields: 'id,title,parent'
[9921] Fix | Delete
};
[9922] Fix | Delete
[9923] Fix | Delete
// Perform a search when the field is changed.
[9924] Fix | Delete
if (!!fieldValue) {
[9925] Fix | Delete
query.search = fieldValue;
[9926] Fix | Delete
}
[9927] Fix | Delete
const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null;
[9928] Fix | Delete
return {
[9929] Fix | Delete
isHierarchical: postIsHierarchical,
[9930] Fix | Delete
parentPostId: pageId,
[9931] Fix | Delete
parentPostTitle: parentPost ? getTitle(parentPost) : '',
[9932] Fix | Delete
pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null
[9933] Fix | Delete
};
[9934] Fix | Delete
}, [fieldValue]);
[9935] Fix | Delete
const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
[9936] Fix | Delete
const getOptionsFromTree = (tree, level = 0) => {
[9937] Fix | Delete
const mappedNodes = tree.map(treeNode => [{
[9938] Fix | Delete
value: treeNode.id,
[9939] Fix | Delete
label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name),
[9940] Fix | Delete
rawName: treeNode.name
[9941] Fix | Delete
}, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
[9942] Fix | Delete
const sortedNodes = mappedNodes.sort(([a], [b]) => {
[9943] Fix | Delete
const priorityA = getItemPriority(a.rawName, fieldValue);
[9944] Fix | Delete
const priorityB = getItemPriority(b.rawName, fieldValue);
[9945] Fix | Delete
return priorityA >= priorityB ? 1 : -1;
[9946] Fix | Delete
});
[9947] Fix | Delete
return sortedNodes.flat();
[9948] Fix | Delete
};
[9949] Fix | Delete
if (!pageItems) {
[9950] Fix | Delete
return [];
[9951] Fix | Delete
}
[9952] Fix | Delete
let tree = pageItems.map(item => ({
[9953] Fix | Delete
id: item.id,
[9954] Fix | Delete
parent: item.parent,
[9955] Fix | Delete
name: getTitle(item)
[9956] Fix | Delete
}));
[9957] Fix | Delete
[9958] Fix | Delete
// Only build a hierarchical tree when not searching.
[9959] Fix | Delete
if (!fieldValue) {
[9960] Fix | Delete
tree = buildTermsTree(tree);
[9961] Fix | Delete
}
[9962] Fix | Delete
const opts = getOptionsFromTree(tree);
[9963] Fix | Delete
[9964] Fix | Delete
// Ensure the current parent is in the options list.
[9965] Fix | Delete
const optsHasParent = opts.find(item => item.value === parentPostId);
[9966] Fix | Delete
if (parentPostTitle && !optsHasParent) {
[9967] Fix | Delete
opts.unshift({
[9968] Fix | Delete
value: parentPostId,
[9969] Fix | Delete
label: parentPostTitle
[9970] Fix | Delete
});
[9971] Fix | Delete
}
[9972] Fix | Delete
return opts;
[9973] Fix | Delete
}, [pageItems, fieldValue, parentPostTitle, parentPostId]);
[9974] Fix | Delete
if (!isHierarchical) {
[9975] Fix | Delete
return null;
[9976] Fix | Delete
}
[9977] Fix | Delete
/**
[9978] Fix | Delete
* Handle user input.
[9979] Fix | Delete
*
[9980] Fix | Delete
* @param {string} inputValue The current value of the input field.
[9981] Fix | Delete
*/
[9982] Fix | Delete
const handleKeydown = inputValue => {
[9983] Fix | Delete
setFieldValue(inputValue);
[9984] Fix | Delete
};
[9985] Fix | Delete
[9986] Fix | Delete
/**
[9987] Fix | Delete
* Handle author selection.
[9988] Fix | Delete
*
[9989] Fix | Delete
* @param {Object} selectedPostId The selected Author.
[9990] Fix | Delete
*/
[9991] Fix | Delete
const handleChange = selectedPostId => {
[9992] Fix | Delete
editPost({
[9993] Fix | Delete
parent: selectedPostId
[9994] Fix | Delete
});
[9995] Fix | Delete
};
[9996] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
[9997] Fix | Delete
__nextHasNoMarginBottom: true,
[9998] Fix | Delete
__next40pxDefaultSize: true,
[9999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function