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
children: (0,external_wp_i18n_namespaceObject.__)('Add tags')
[15500] Fix | Delete
}, "label")];
[15501] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
[15502] Fix | Delete
initialOpen: false,
[15503] Fix | Delete
title: panelBodyTitle,
[15504] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[15505] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')
[15506] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector, {
[15507] Fix | Delete
slug: "post_tag"
[15508] Fix | Delete
})]
[15509] Fix | Delete
});
[15510] Fix | Delete
};
[15511] Fix | Delete
const MaybeTagsPanel = () => {
[15512] Fix | Delete
const {
[15513] Fix | Delete
hasTags,
[15514] Fix | Delete
isPostTypeSupported
[15515] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[15516] Fix | Delete
const postType = select(store_store).getCurrentPostType();
[15517] Fix | Delete
const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag');
[15518] Fix | Delete
const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType);
[15519] Fix | Delete
const areTagsFetched = tagsTaxonomy !== undefined;
[15520] Fix | Delete
const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base);
[15521] Fix | Delete
return {
[15522] Fix | Delete
hasTags: !!tags?.length,
[15523] Fix | Delete
isPostTypeSupported: areTagsFetched && _isPostTypeSupported
[15524] Fix | Delete
};
[15525] Fix | Delete
}, []);
[15526] Fix | Delete
const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(hasTags);
[15527] Fix | Delete
if (!isPostTypeSupported) {
[15528] Fix | Delete
return null;
[15529] Fix | Delete
}
[15530] Fix | Delete
[15531] Fix | Delete
/*
[15532] Fix | Delete
* We only want to show the tag panel if the post didn't have
[15533] Fix | Delete
* any tags when the user hit the Publish button.
[15534] Fix | Delete
*
[15535] Fix | Delete
* We can't use the prop.hasTags because it'll change to true
[15536] Fix | Delete
* if the user adds a new tag within the pre-publish panel.
[15537] Fix | Delete
* This would force a re-render and a new prop.hasTags check,
[15538] Fix | Delete
* hiding this panel and keeping the user from adding
[15539] Fix | Delete
* more than one tag.
[15540] Fix | Delete
*/
[15541] Fix | Delete
if (!hadTagsWhenOpeningThePanel) {
[15542] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {});
[15543] Fix | Delete
}
[15544] Fix | Delete
return null;
[15545] Fix | Delete
};
[15546] Fix | Delete
/* harmony default export */ const maybe_tags_panel = (MaybeTagsPanel);
[15547] Fix | Delete
[15548] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
[15549] Fix | Delete
/**
[15550] Fix | Delete
* WordPress dependencies
[15551] Fix | Delete
*/
[15552] Fix | Delete
[15553] Fix | Delete
[15554] Fix | Delete
[15555] Fix | Delete
[15556] Fix | Delete
[15557] Fix | Delete
/**
[15558] Fix | Delete
* Internal dependencies
[15559] Fix | Delete
*/
[15560] Fix | Delete
[15561] Fix | Delete
[15562] Fix | Delete
[15563] Fix | Delete
[15564] Fix | Delete
const getSuggestion = (supportedFormats, suggestedPostFormat) => {
[15565] Fix | Delete
const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id));
[15566] Fix | Delete
return formats.find(format => format.id === suggestedPostFormat);
[15567] Fix | Delete
};
[15568] Fix | Delete
const PostFormatSuggestion = ({
[15569] Fix | Delete
suggestedPostFormat,
[15570] Fix | Delete
suggestionText,
[15571] Fix | Delete
onUpdatePostFormat
[15572] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[15573] Fix | Delete
variant: "link",
[15574] Fix | Delete
onClick: () => onUpdatePostFormat(suggestedPostFormat),
[15575] Fix | Delete
children: suggestionText
[15576] Fix | Delete
});
[15577] Fix | Delete
function PostFormatPanel() {
[15578] Fix | Delete
const {
[15579] Fix | Delete
currentPostFormat,
[15580] Fix | Delete
suggestion
[15581] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[15582] Fix | Delete
var _select$getThemeSuppo;
[15583] Fix | Delete
const {
[15584] Fix | Delete
getEditedPostAttribute,
[15585] Fix | Delete
getSuggestedPostFormat
[15586] Fix | Delete
} = select(store_store);
[15587] Fix | Delete
const supportedFormats = (_select$getThemeSuppo = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats) !== null && _select$getThemeSuppo !== void 0 ? _select$getThemeSuppo : [];
[15588] Fix | Delete
return {
[15589] Fix | Delete
currentPostFormat: getEditedPostAttribute('format'),
[15590] Fix | Delete
suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
[15591] Fix | Delete
};
[15592] Fix | Delete
}, []);
[15593] Fix | Delete
const {
[15594] Fix | Delete
editPost
[15595] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[15596] Fix | Delete
const onUpdatePostFormat = format => editPost({
[15597] Fix | Delete
format
[15598] Fix | Delete
});
[15599] Fix | Delete
const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[15600] Fix | Delete
className: "editor-post-publish-panel__link",
[15601] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Use a post format')
[15602] Fix | Delete
}, "label")];
[15603] Fix | Delete
if (!suggestion || suggestion.id === currentPostFormat) {
[15604] Fix | Delete
return null;
[15605] Fix | Delete
}
[15606] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
[15607] Fix | Delete
initialOpen: false,
[15608] Fix | Delete
title: panelBodyTitle,
[15609] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[15610] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')
[15611] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[15612] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatSuggestion, {
[15613] Fix | Delete
onUpdatePostFormat: onUpdatePostFormat,
[15614] Fix | Delete
suggestedPostFormat: suggestion.id,
[15615] Fix | Delete
suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
[15616] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
[15617] Fix | Delete
})
[15618] Fix | Delete
})]
[15619] Fix | Delete
});
[15620] Fix | Delete
}
[15621] Fix | Delete
[15622] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
[15623] Fix | Delete
/**
[15624] Fix | Delete
* WordPress dependencies
[15625] Fix | Delete
*/
[15626] Fix | Delete
[15627] Fix | Delete
[15628] Fix | Delete
[15629] Fix | Delete
[15630] Fix | Delete
[15631] Fix | Delete
[15632] Fix | Delete
[15633] Fix | Delete
[15634] Fix | Delete
[15635] Fix | Delete
[15636] Fix | Delete
/**
[15637] Fix | Delete
* Internal dependencies
[15638] Fix | Delete
*/
[15639] Fix | Delete
[15640] Fix | Delete
[15641] Fix | Delete
[15642] Fix | Delete
/**
[15643] Fix | Delete
* Module Constants
[15644] Fix | Delete
*/
[15645] Fix | Delete
[15646] Fix | Delete
[15647] Fix | Delete
const hierarchical_term_selector_DEFAULT_QUERY = {
[15648] Fix | Delete
per_page: -1,
[15649] Fix | Delete
orderby: 'name',
[15650] Fix | Delete
order: 'asc',
[15651] Fix | Delete
_fields: 'id,name,parent',
[15652] Fix | Delete
context: 'view'
[15653] Fix | Delete
};
[15654] Fix | Delete
const MIN_TERMS_COUNT_FOR_FILTER = 8;
[15655] Fix | Delete
const hierarchical_term_selector_EMPTY_ARRAY = [];
[15656] Fix | Delete
[15657] Fix | Delete
/**
[15658] Fix | Delete
* Sort Terms by Selected.
[15659] Fix | Delete
*
[15660] Fix | Delete
* @param {Object[]} termsTree Array of terms in tree format.
[15661] Fix | Delete
* @param {number[]} terms Selected terms.
[15662] Fix | Delete
*
[15663] Fix | Delete
* @return {Object[]} Sorted array of terms.
[15664] Fix | Delete
*/
[15665] Fix | Delete
function sortBySelected(termsTree, terms) {
[15666] Fix | Delete
const treeHasSelection = termTree => {
[15667] Fix | Delete
if (terms.indexOf(termTree.id) !== -1) {
[15668] Fix | Delete
return true;
[15669] Fix | Delete
}
[15670] Fix | Delete
if (undefined === termTree.children) {
[15671] Fix | Delete
return false;
[15672] Fix | Delete
}
[15673] Fix | Delete
return termTree.children.map(treeHasSelection).filter(child => child).length > 0;
[15674] Fix | Delete
};
[15675] Fix | Delete
const termOrChildIsSelected = (termA, termB) => {
[15676] Fix | Delete
const termASelected = treeHasSelection(termA);
[15677] Fix | Delete
const termBSelected = treeHasSelection(termB);
[15678] Fix | Delete
if (termASelected === termBSelected) {
[15679] Fix | Delete
return 0;
[15680] Fix | Delete
}
[15681] Fix | Delete
if (termASelected && !termBSelected) {
[15682] Fix | Delete
return -1;
[15683] Fix | Delete
}
[15684] Fix | Delete
if (!termASelected && termBSelected) {
[15685] Fix | Delete
return 1;
[15686] Fix | Delete
}
[15687] Fix | Delete
return 0;
[15688] Fix | Delete
};
[15689] Fix | Delete
const newTermTree = [...termsTree];
[15690] Fix | Delete
newTermTree.sort(termOrChildIsSelected);
[15691] Fix | Delete
return newTermTree;
[15692] Fix | Delete
}
[15693] Fix | Delete
[15694] Fix | Delete
/**
[15695] Fix | Delete
* Find term by parent id or name.
[15696] Fix | Delete
*
[15697] Fix | Delete
* @param {Object[]} terms Array of Terms.
[15698] Fix | Delete
* @param {number|string} parent id.
[15699] Fix | Delete
* @param {string} name Term name.
[15700] Fix | Delete
* @return {Object} Term object.
[15701] Fix | Delete
*/
[15702] Fix | Delete
function findTerm(terms, parent, name) {
[15703] Fix | Delete
return terms.find(term => {
[15704] Fix | Delete
return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
[15705] Fix | Delete
});
[15706] Fix | Delete
}
[15707] Fix | Delete
[15708] Fix | Delete
/**
[15709] Fix | Delete
* Get filter matcher function.
[15710] Fix | Delete
*
[15711] Fix | Delete
* @param {string} filterValue Filter value.
[15712] Fix | Delete
* @return {(function(Object): (Object|boolean))} Matcher function.
[15713] Fix | Delete
*/
[15714] Fix | Delete
function getFilterMatcher(filterValue) {
[15715] Fix | Delete
const matchTermsForFilter = originalTerm => {
[15716] Fix | Delete
if ('' === filterValue) {
[15717] Fix | Delete
return originalTerm;
[15718] Fix | Delete
}
[15719] Fix | Delete
[15720] Fix | Delete
// Shallow clone, because we'll be filtering the term's children and
[15721] Fix | Delete
// don't want to modify the original term.
[15722] Fix | Delete
const term = {
[15723] Fix | Delete
...originalTerm
[15724] Fix | Delete
};
[15725] Fix | Delete
[15726] Fix | Delete
// Map and filter the children, recursive so we deal with grandchildren
[15727] Fix | Delete
// and any deeper levels.
[15728] Fix | Delete
if (term.children.length > 0) {
[15729] Fix | Delete
term.children = term.children.map(matchTermsForFilter).filter(child => child);
[15730] Fix | Delete
}
[15731] Fix | Delete
[15732] Fix | Delete
// If the term's name contains the filterValue, or it has children
[15733] Fix | Delete
// (i.e. some child matched at some point in the tree) then return it.
[15734] Fix | Delete
if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
[15735] Fix | Delete
return term;
[15736] Fix | Delete
}
[15737] Fix | Delete
[15738] Fix | Delete
// Otherwise, return false. After mapping, the list of terms will need
[15739] Fix | Delete
// to have false values filtered out.
[15740] Fix | Delete
return false;
[15741] Fix | Delete
};
[15742] Fix | Delete
return matchTermsForFilter;
[15743] Fix | Delete
}
[15744] Fix | Delete
[15745] Fix | Delete
/**
[15746] Fix | Delete
* Hierarchical term selector.
[15747] Fix | Delete
*
[15748] Fix | Delete
* @param {Object} props Component props.
[15749] Fix | Delete
* @param {string} props.slug Taxonomy slug.
[15750] Fix | Delete
* @return {Element} Hierarchical term selector component.
[15751] Fix | Delete
*/
[15752] Fix | Delete
function HierarchicalTermSelector({
[15753] Fix | Delete
slug
[15754] Fix | Delete
}) {
[15755] Fix | Delete
var _taxonomy$labels$sear, _taxonomy$name;
[15756] Fix | Delete
const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false);
[15757] Fix | Delete
const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)('');
[15758] Fix | Delete
/**
[15759] Fix | Delete
* @type {[number|'', Function]}
[15760] Fix | Delete
*/
[15761] Fix | Delete
const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)('');
[15762] Fix | Delete
const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false);
[15763] Fix | Delete
const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
[15764] Fix | Delete
const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]);
[15765] Fix | Delete
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
[15766] Fix | Delete
const {
[15767] Fix | Delete
hasCreateAction,
[15768] Fix | Delete
hasAssignAction,
[15769] Fix | Delete
terms,
[15770] Fix | Delete
loading,
[15771] Fix | Delete
availableTerms,
[15772] Fix | Delete
taxonomy
[15773] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[15774] Fix | Delete
var _post$_links, _post$_links2;
[15775] Fix | Delete
const {
[15776] Fix | Delete
getCurrentPost,
[15777] Fix | Delete
getEditedPostAttribute
[15778] Fix | Delete
} = select(store_store);
[15779] Fix | Delete
const {
[15780] Fix | Delete
getTaxonomy,
[15781] Fix | Delete
getEntityRecords,
[15782] Fix | Delete
isResolving
[15783] Fix | Delete
} = select(external_wp_coreData_namespaceObject.store);
[15784] Fix | Delete
const _taxonomy = getTaxonomy(slug);
[15785] Fix | Delete
const post = getCurrentPost();
[15786] Fix | Delete
return {
[15787] Fix | Delete
hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
[15788] Fix | Delete
hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
[15789] Fix | Delete
terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY,
[15790] Fix | Delete
loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]),
[15791] Fix | Delete
availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY,
[15792] Fix | Delete
taxonomy: _taxonomy
[15793] Fix | Delete
};
[15794] Fix | Delete
}, [slug]);
[15795] Fix | Delete
const {
[15796] Fix | Delete
editPost
[15797] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
[15798] Fix | Delete
const {
[15799] Fix | Delete
saveEntityRecord
[15800] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
[15801] Fix | Delete
const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms),
[15802] Fix | Delete
// Remove `terms` from the dependency list to avoid reordering every time
[15803] Fix | Delete
// checking or unchecking a term.
[15804] Fix | Delete
[availableTerms]);
[15805] Fix | Delete
const {
[15806] Fix | Delete
createErrorNotice
[15807] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[15808] Fix | Delete
if (!hasAssignAction) {
[15809] Fix | Delete
return null;
[15810] Fix | Delete
}
[15811] Fix | Delete
[15812] Fix | Delete
/**
[15813] Fix | Delete
* Append new term.
[15814] Fix | Delete
*
[15815] Fix | Delete
* @param {Object} term Term object.
[15816] Fix | Delete
* @return {Promise} A promise that resolves to save term object.
[15817] Fix | Delete
*/
[15818] Fix | Delete
const addTerm = term => {
[15819] Fix | Delete
return saveEntityRecord('taxonomy', slug, term, {
[15820] Fix | Delete
throwOnError: true
[15821] Fix | Delete
});
[15822] Fix | Delete
};
[15823] Fix | Delete
[15824] Fix | Delete
/**
[15825] Fix | Delete
* Update terms for post.
[15826] Fix | Delete
*
[15827] Fix | Delete
* @param {number[]} termIds Term ids.
[15828] Fix | Delete
*/
[15829] Fix | Delete
const onUpdateTerms = termIds => {
[15830] Fix | Delete
editPost({
[15831] Fix | Delete
[taxonomy.rest_base]: termIds
[15832] Fix | Delete
});
[15833] Fix | Delete
};
[15834] Fix | Delete
[15835] Fix | Delete
/**
[15836] Fix | Delete
* Handler for checking term.
[15837] Fix | Delete
*
[15838] Fix | Delete
* @param {number} termId
[15839] Fix | Delete
*/
[15840] Fix | Delete
const onChange = termId => {
[15841] Fix | Delete
const hasTerm = terms.includes(termId);
[15842] Fix | Delete
const newTerms = hasTerm ? terms.filter(id => id !== termId) : [...terms, termId];
[15843] Fix | Delete
onUpdateTerms(newTerms);
[15844] Fix | Delete
};
[15845] Fix | Delete
const onChangeFormName = value => {
[15846] Fix | Delete
setFormName(value);
[15847] Fix | Delete
};
[15848] Fix | Delete
[15849] Fix | Delete
/**
[15850] Fix | Delete
* Handler for changing form parent.
[15851] Fix | Delete
*
[15852] Fix | Delete
* @param {number|''} parentId Parent post id.
[15853] Fix | Delete
*/
[15854] Fix | Delete
const onChangeFormParent = parentId => {
[15855] Fix | Delete
setFormParent(parentId);
[15856] Fix | Delete
};
[15857] Fix | Delete
const onToggleForm = () => {
[15858] Fix | Delete
setShowForm(!showForm);
[15859] Fix | Delete
};
[15860] Fix | Delete
const onAddTerm = async event => {
[15861] Fix | Delete
var _taxonomy$labels$sing;
[15862] Fix | Delete
event.preventDefault();
[15863] Fix | Delete
if (formName === '' || adding) {
[15864] Fix | Delete
return;
[15865] Fix | Delete
}
[15866] Fix | Delete
[15867] Fix | Delete
// Check if the term we are adding already exists.
[15868] Fix | Delete
const existingTerm = findTerm(availableTerms, formParent, formName);
[15869] Fix | Delete
if (existingTerm) {
[15870] Fix | Delete
// If the term we are adding exists but is not selected select it.
[15871] Fix | Delete
if (!terms.some(term => term === existingTerm.id)) {
[15872] Fix | Delete
onUpdateTerms([...terms, existingTerm.id]);
[15873] Fix | Delete
}
[15874] Fix | Delete
setFormName('');
[15875] Fix | Delete
setFormParent('');
[15876] Fix | Delete
return;
[15877] Fix | Delete
}
[15878] Fix | Delete
setAdding(true);
[15879] Fix | Delete
let newTerm;
[15880] Fix | Delete
try {
[15881] Fix | Delete
newTerm = await addTerm({
[15882] Fix | Delete
name: formName,
[15883] Fix | Delete
parent: formParent ? formParent : undefined
[15884] Fix | Delete
});
[15885] Fix | Delete
} catch (error) {
[15886] Fix | Delete
createErrorNotice(error.message, {
[15887] Fix | Delete
type: 'snackbar'
[15888] Fix | Delete
});
[15889] Fix | Delete
return;
[15890] Fix | Delete
}
[15891] Fix | Delete
const defaultName = slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term');
[15892] Fix | Delete
const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: taxonomy name */
[15893] Fix | Delete
(0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
[15894] Fix | Delete
(0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
[15895] Fix | Delete
setAdding(false);
[15896] Fix | Delete
setFormName('');
[15897] Fix | Delete
setFormParent('');
[15898] Fix | Delete
onUpdateTerms([...terms, newTerm.id]);
[15899] Fix | Delete
};
[15900] Fix | Delete
const setFilter = value => {
[15901] Fix | Delete
const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term);
[15902] Fix | Delete
const getResultCount = termsTree => {
[15903] Fix | Delete
let count = 0;
[15904] Fix | Delete
for (let i = 0; i < termsTree.length; i++) {
[15905] Fix | Delete
count++;
[15906] Fix | Delete
if (undefined !== termsTree[i].children) {
[15907] Fix | Delete
count += getResultCount(termsTree[i].children);
[15908] Fix | Delete
}
[15909] Fix | Delete
}
[15910] Fix | Delete
return count;
[15911] Fix | Delete
};
[15912] Fix | Delete
setFilterValue(value);
[15913] Fix | Delete
setFilteredTermsTree(newFilteredTermsTree);
[15914] Fix | Delete
const resultCount = getResultCount(newFilteredTermsTree);
[15915] Fix | Delete
const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results */
[15916] Fix | Delete
(0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount);
[15917] Fix | Delete
debouncedSpeak(resultsFoundMessage, 'assertive');
[15918] Fix | Delete
};
[15919] Fix | Delete
const renderTerms = renderedTerms => {
[15920] Fix | Delete
return renderedTerms.map(term => {
[15921] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[15922] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-choice",
[15923] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
[15924] Fix | Delete
__nextHasNoMarginBottom: true,
[15925] Fix | Delete
checked: terms.indexOf(term.id) !== -1,
[15926] Fix | Delete
onChange: () => {
[15927] Fix | Delete
const termId = parseInt(term.id, 10);
[15928] Fix | Delete
onChange(termId);
[15929] Fix | Delete
},
[15930] Fix | Delete
label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name)
[15931] Fix | Delete
}), !!term.children.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[15932] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-subchoices",
[15933] Fix | Delete
children: renderTerms(term.children)
[15934] Fix | Delete
})]
[15935] Fix | Delete
}, term.id);
[15936] Fix | Delete
});
[15937] Fix | Delete
};
[15938] Fix | Delete
const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => {
[15939] Fix | Delete
var _taxonomy$labels$labe;
[15940] Fix | Delete
return (_taxonomy$labels$labe = taxonomy?.labels?.[labelProperty]) !== null && _taxonomy$labels$labe !== void 0 ? _taxonomy$labels$labe : slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory;
[15941] Fix | Delete
};
[15942] Fix | Delete
const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
[15943] Fix | Delete
const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
[15944] Fix | Delete
const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term'));
[15945] Fix | Delete
const noParentOption = `— ${parentSelectLabel} —`;
[15946] Fix | Delete
const newTermSubmitLabel = newTermButtonLabel;
[15947] Fix | Delete
const filterLabel = (_taxonomy$labels$sear = taxonomy?.labels?.search_items) !== null && _taxonomy$labels$sear !== void 0 ? _taxonomy$labels$sear : (0,external_wp_i18n_namespaceObject.__)('Search Terms');
[15948] Fix | Delete
const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms');
[15949] Fix | Delete
const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
[15950] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
[15951] Fix | Delete
direction: "column",
[15952] Fix | Delete
gap: "4",
[15953] Fix | Delete
children: [showFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
[15954] Fix | Delete
__nextHasNoMarginBottom: true,
[15955] Fix | Delete
label: filterLabel,
[15956] Fix | Delete
value: filterValue,
[15957] Fix | Delete
onChange: setFilter
[15958] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[15959] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-list",
[15960] Fix | Delete
tabIndex: "0",
[15961] Fix | Delete
role: "group",
[15962] Fix | Delete
"aria-label": groupLabel,
[15963] Fix | Delete
children: renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)
[15964] Fix | Delete
}), !loading && hasCreateAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
[15965] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[15966] Fix | Delete
onClick: onToggleForm,
[15967] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-add",
[15968] Fix | Delete
"aria-expanded": showForm,
[15969] Fix | Delete
variant: "link",
[15970] Fix | Delete
children: newTermButtonLabel
[15971] Fix | Delete
})
[15972] Fix | Delete
}), showForm && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
[15973] Fix | Delete
onSubmit: onAddTerm,
[15974] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
[15975] Fix | Delete
direction: "column",
[15976] Fix | Delete
gap: "4",
[15977] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
[15978] Fix | Delete
__next40pxDefaultSize: true,
[15979] Fix | Delete
__nextHasNoMarginBottom: true,
[15980] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-input",
[15981] Fix | Delete
label: newTermLabel,
[15982] Fix | Delete
value: formName,
[15983] Fix | Delete
onChange: onChangeFormName,
[15984] Fix | Delete
required: true
[15985] Fix | Delete
}), !!availableTerms.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TreeSelect, {
[15986] Fix | Delete
__next40pxDefaultSize: true,
[15987] Fix | Delete
__nextHasNoMarginBottom: true,
[15988] Fix | Delete
label: parentSelectLabel,
[15989] Fix | Delete
noOptionLabel: noParentOption,
[15990] Fix | Delete
onChange: onChangeFormParent,
[15991] Fix | Delete
selectedId: formParent,
[15992] Fix | Delete
tree: availableTermsTree
[15993] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
[15994] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[15995] Fix | Delete
__next40pxDefaultSize: true,
[15996] Fix | Delete
variant: "secondary",
[15997] Fix | Delete
type: "submit",
[15998] Fix | Delete
className: "editor-post-taxonomies__hierarchical-terms-submit",
[15999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function