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
}
[22500] Fix | Delete
const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
[22501] Fix | Delete
const defaultTo = d => v => {
[22502] Fix | Delete
return v === null || v === undefined || v !== v ? d : v;
[22503] Fix | Delete
};
[22504] Fix | Delete
[22505] Fix | Delete
/**
[22506] Fix | Delete
* Prepares a URL for display in the UI.
[22507] Fix | Delete
* - decodes the URL.
[22508] Fix | Delete
* - filters it (removes protocol, www, etc.).
[22509] Fix | Delete
* - truncates it if necessary.
[22510] Fix | Delete
* - adds a leading slash.
[22511] Fix | Delete
* @param {string} url the url.
[22512] Fix | Delete
* @return {string} the processed url to display.
[22513] Fix | Delete
*/
[22514] Fix | Delete
function getURLForDisplay(url) {
[22515] Fix | Delete
if (!url) {
[22516] Fix | Delete
return url;
[22517] Fix | Delete
}
[22518] Fix | Delete
return (0,external_wp_compose_namespaceObject.pipe)(external_wp_url_namespaceObject.safeDecodeURI, external_wp_url_namespaceObject.getPath, defaultTo(''), partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url);
[22519] Fix | Delete
}
[22520] Fix | Delete
const LinkControlSearchItem = ({
[22521] Fix | Delete
itemProps,
[22522] Fix | Delete
suggestion,
[22523] Fix | Delete
searchTerm,
[22524] Fix | Delete
onClick,
[22525] Fix | Delete
isURL = false,
[22526] Fix | Delete
shouldShowType = false
[22527] Fix | Delete
}) => {
[22528] Fix | Delete
const info = isURL ? (0,external_wp_i18n_namespaceObject.__)('Press ENTER to add this link') : getURLForDisplay(suggestion.url);
[22529] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[22530] Fix | Delete
...itemProps,
[22531] Fix | Delete
info: info,
[22532] Fix | Delete
iconPosition: "left",
[22533] Fix | Delete
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, {
[22534] Fix | Delete
suggestion: suggestion,
[22535] Fix | Delete
isURL: isURL
[22536] Fix | Delete
}),
[22537] Fix | Delete
onClick: onClick,
[22538] Fix | Delete
shortcut: shouldShowType && getVisualTypeName(suggestion),
[22539] Fix | Delete
className: "block-editor-link-control__search-item",
[22540] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight
[22541] Fix | Delete
// The component expects a plain text string.
[22542] Fix | Delete
, {
[22543] Fix | Delete
text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title),
[22544] Fix | Delete
highlight: searchTerm
[22545] Fix | Delete
})
[22546] Fix | Delete
});
[22547] Fix | Delete
};
[22548] Fix | Delete
function getVisualTypeName(suggestion) {
[22549] Fix | Delete
if (suggestion.isFrontPage) {
[22550] Fix | Delete
return 'front page';
[22551] Fix | Delete
}
[22552] Fix | Delete
if (suggestion.isBlogHome) {
[22553] Fix | Delete
return 'blog home';
[22554] Fix | Delete
}
[22555] Fix | Delete
[22556] Fix | Delete
// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.
[22557] Fix | Delete
return suggestion.type === 'post_tag' ? 'tag' : suggestion.type;
[22558] Fix | Delete
}
[22559] Fix | Delete
/* harmony default export */ const search_item = (LinkControlSearchItem);
[22560] Fix | Delete
[22561] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js
[22562] Fix | Delete
/**
[22563] Fix | Delete
* WordPress dependencies
[22564] Fix | Delete
*/
[22565] Fix | Delete
[22566] Fix | Delete
[22567] Fix | Delete
// Used as a unique identifier for the "Create" option within search results.
[22568] Fix | Delete
// Used to help distinguish the "Create" suggestion within the search results in
[22569] Fix | Delete
// order to handle it as a unique case.
[22570] Fix | Delete
const CREATE_TYPE = '__CREATE__';
[22571] Fix | Delete
const TEL_TYPE = 'tel';
[22572] Fix | Delete
const URL_TYPE = 'link';
[22573] Fix | Delete
const MAILTO_TYPE = 'mailto';
[22574] Fix | Delete
const INTERNAL_TYPE = 'internal';
[22575] Fix | Delete
const LINK_ENTRY_TYPES = [URL_TYPE, MAILTO_TYPE, TEL_TYPE, INTERNAL_TYPE];
[22576] Fix | Delete
const DEFAULT_LINK_SETTINGS = [{
[22577] Fix | Delete
id: 'opensInNewTab',
[22578] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Open in new tab')
[22579] Fix | Delete
}];
[22580] Fix | Delete
[22581] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js
[22582] Fix | Delete
/**
[22583] Fix | Delete
* WordPress dependencies
[22584] Fix | Delete
*/
[22585] Fix | Delete
[22586] Fix | Delete
[22587] Fix | Delete
[22588] Fix | Delete
/**
[22589] Fix | Delete
* External dependencies
[22590] Fix | Delete
*/
[22591] Fix | Delete
[22592] Fix | Delete
[22593] Fix | Delete
/**
[22594] Fix | Delete
* Internal dependencies
[22595] Fix | Delete
*/
[22596] Fix | Delete
[22597] Fix | Delete
[22598] Fix | Delete
[22599] Fix | Delete
[22600] Fix | Delete
[22601] Fix | Delete
function LinkControlSearchResults({
[22602] Fix | Delete
instanceId,
[22603] Fix | Delete
withCreateSuggestion,
[22604] Fix | Delete
currentInputValue,
[22605] Fix | Delete
handleSuggestionClick,
[22606] Fix | Delete
suggestionsListProps,
[22607] Fix | Delete
buildSuggestionItemProps,
[22608] Fix | Delete
suggestions,
[22609] Fix | Delete
selectedSuggestion,
[22610] Fix | Delete
isLoading,
[22611] Fix | Delete
isInitialSuggestions,
[22612] Fix | Delete
createSuggestionButtonText,
[22613] Fix | Delete
suggestionsQuery
[22614] Fix | Delete
}) {
[22615] Fix | Delete
const resultsListClasses = dist_clsx('block-editor-link-control__search-results', {
[22616] Fix | Delete
'is-loading': isLoading
[22617] Fix | Delete
});
[22618] Fix | Delete
const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type);
[22619] Fix | Delete
const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions;
[22620] Fix | Delete
// If the query has a specified type, then we can skip showing them in the result. See #24839.
[22621] Fix | Delete
const shouldShowSuggestionsTypes = !suggestionsQuery?.type;
[22622] Fix | Delete
[22623] Fix | Delete
// According to guidelines aria-label should be added if the label
[22624] Fix | Delete
// itself is not visible.
[22625] Fix | Delete
// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role
[22626] Fix | Delete
const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`;
[22627] Fix | Delete
const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)('Suggestions') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */
[22628] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue);
[22629] Fix | Delete
const searchResultsLabel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
[22630] Fix | Delete
id: searchResultsLabelId,
[22631] Fix | Delete
children: labelText
[22632] Fix | Delete
});
[22633] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[22634] Fix | Delete
className: "block-editor-link-control__search-results-wrapper",
[22635] Fix | Delete
children: [searchResultsLabel, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[22636] Fix | Delete
...suggestionsListProps,
[22637] Fix | Delete
className: resultsListClasses,
[22638] Fix | Delete
"aria-labelledby": searchResultsLabelId,
[22639] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
[22640] Fix | Delete
children: suggestions.map((suggestion, index) => {
[22641] Fix | Delete
if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) {
[22642] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_create_button, {
[22643] Fix | Delete
searchTerm: currentInputValue,
[22644] Fix | Delete
buttonText: createSuggestionButtonText,
[22645] Fix | Delete
onClick: () => handleSuggestionClick(suggestion)
[22646] Fix | Delete
// Intentionally only using `type` here as
[22647] Fix | Delete
// the constant is enough to uniquely
[22648] Fix | Delete
// identify the single "CREATE" suggestion.
[22649] Fix | Delete
,
[22650] Fix | Delete
[22651] Fix | Delete
itemProps: buildSuggestionItemProps(suggestion, index),
[22652] Fix | Delete
isSelected: index === selectedSuggestion
[22653] Fix | Delete
}, suggestion.type);
[22654] Fix | Delete
}
[22655] Fix | Delete
[22656] Fix | Delete
// If we're not handling "Create" suggestions above then
[22657] Fix | Delete
// we don't want them in the main results so exit early.
[22658] Fix | Delete
if (CREATE_TYPE === suggestion.type) {
[22659] Fix | Delete
return null;
[22660] Fix | Delete
}
[22661] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_item, {
[22662] Fix | Delete
itemProps: buildSuggestionItemProps(suggestion, index),
[22663] Fix | Delete
suggestion: suggestion,
[22664] Fix | Delete
index: index,
[22665] Fix | Delete
onClick: () => {
[22666] Fix | Delete
handleSuggestionClick(suggestion);
[22667] Fix | Delete
},
[22668] Fix | Delete
isSelected: index === selectedSuggestion,
[22669] Fix | Delete
isURL: LINK_ENTRY_TYPES.includes(suggestion.type),
[22670] Fix | Delete
searchTerm: currentInputValue,
[22671] Fix | Delete
shouldShowType: shouldShowSuggestionsTypes,
[22672] Fix | Delete
isFrontPage: suggestion?.isFrontPage,
[22673] Fix | Delete
isBlogHome: suggestion?.isBlogHome
[22674] Fix | Delete
}, `${suggestion.id}-${suggestion.type}`);
[22675] Fix | Delete
})
[22676] Fix | Delete
})
[22677] Fix | Delete
})]
[22678] Fix | Delete
});
[22679] Fix | Delete
}
[22680] Fix | Delete
[22681] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js
[22682] Fix | Delete
/**
[22683] Fix | Delete
* WordPress dependencies
[22684] Fix | Delete
*/
[22685] Fix | Delete
[22686] Fix | Delete
[22687] Fix | Delete
/**
[22688] Fix | Delete
* Determines whether a given value could be a URL. Note this does not
[22689] Fix | Delete
* guarantee the value is a URL only that it looks like it might be one. For
[22690] Fix | Delete
* example, just because a string has `www.` in it doesn't make it a URL,
[22691] Fix | Delete
* but it does make it highly likely that it will be so in the context of
[22692] Fix | Delete
* creating a link it makes sense to treat it like one.
[22693] Fix | Delete
*
[22694] Fix | Delete
* @param {string} val the candidate for being URL-like (or not).
[22695] Fix | Delete
*
[22696] Fix | Delete
* @return {boolean} whether or not the value is potentially a URL.
[22697] Fix | Delete
*/
[22698] Fix | Delete
function isURLLike(val) {
[22699] Fix | Delete
const hasSpaces = val.includes(' ');
[22700] Fix | Delete
if (hasSpaces) {
[22701] Fix | Delete
return false;
[22702] Fix | Delete
}
[22703] Fix | Delete
const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val);
[22704] Fix | Delete
const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol);
[22705] Fix | Delete
const mayBeTLD = hasPossibleTLD(val);
[22706] Fix | Delete
const isWWW = val?.startsWith('www.');
[22707] Fix | Delete
const isInternal = val?.startsWith('#') && (0,external_wp_url_namespaceObject.isValidFragment)(val);
[22708] Fix | Delete
return protocolIsValid || isWWW || isInternal || mayBeTLD;
[22709] Fix | Delete
}
[22710] Fix | Delete
[22711] Fix | Delete
/**
[22712] Fix | Delete
* Checks if a given URL has a valid Top-Level Domain (TLD).
[22713] Fix | Delete
*
[22714] Fix | Delete
* @param {string} url - The URL to check.
[22715] Fix | Delete
* @param {number} maxLength - The maximum length of the TLD.
[22716] Fix | Delete
* @return {boolean} Returns true if the URL has a valid TLD, false otherwise.
[22717] Fix | Delete
*/
[22718] Fix | Delete
function hasPossibleTLD(url, maxLength = 6) {
[22719] Fix | Delete
// Clean the URL by removing anything after the first occurrence of "?" or "#".
[22720] Fix | Delete
const cleanedURL = url.split(/[?#]/)[0];
[22721] Fix | Delete
[22722] Fix | Delete
// Regular expression explanation:
[22723] Fix | Delete
// - (?<=\S) : Positive lookbehind assertion to ensure there is at least one non-whitespace character before the TLD
[22724] Fix | Delete
// - \. : Matches a literal dot (.)
[22725] Fix | Delete
// - [a-zA-Z_]{2,maxLength} : Matches 2 to maxLength letters or underscores, representing the TLD
[22726] Fix | Delete
// - (?:\/|$) : Non-capturing group that matches either a forward slash (/) or the end of the string
[22727] Fix | Delete
const regex = new RegExp(`(?<=\\S)\\.(?:[a-zA-Z_]{2,${maxLength}})(?:\\/|$)`);
[22728] Fix | Delete
return regex.test(cleanedURL);
[22729] Fix | Delete
}
[22730] Fix | Delete
[22731] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js
[22732] Fix | Delete
/**
[22733] Fix | Delete
* WordPress dependencies
[22734] Fix | Delete
*/
[22735] Fix | Delete
[22736] Fix | Delete
[22737] Fix | Delete
[22738] Fix | Delete
[22739] Fix | Delete
/**
[22740] Fix | Delete
* Internal dependencies
[22741] Fix | Delete
*/
[22742] Fix | Delete
[22743] Fix | Delete
[22744] Fix | Delete
[22745] Fix | Delete
const handleNoop = () => Promise.resolve([]);
[22746] Fix | Delete
const handleDirectEntry = val => {
[22747] Fix | Delete
let type = URL_TYPE;
[22748] Fix | Delete
const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || '';
[22749] Fix | Delete
if (protocol.includes('mailto')) {
[22750] Fix | Delete
type = MAILTO_TYPE;
[22751] Fix | Delete
}
[22752] Fix | Delete
if (protocol.includes('tel')) {
[22753] Fix | Delete
type = TEL_TYPE;
[22754] Fix | Delete
}
[22755] Fix | Delete
if (val?.startsWith('#')) {
[22756] Fix | Delete
type = INTERNAL_TYPE;
[22757] Fix | Delete
}
[22758] Fix | Delete
return Promise.resolve([{
[22759] Fix | Delete
id: val,
[22760] Fix | Delete
title: val,
[22761] Fix | Delete
url: type === 'URL' ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val,
[22762] Fix | Delete
type
[22763] Fix | Delete
}]);
[22764] Fix | Delete
};
[22765] Fix | Delete
const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts) => {
[22766] Fix | Delete
const {
[22767] Fix | Delete
isInitialSuggestions
[22768] Fix | Delete
} = suggestionsQuery;
[22769] Fix | Delete
const results = await fetchSearchSuggestions(val, suggestionsQuery);
[22770] Fix | Delete
[22771] Fix | Delete
// Identify front page and update type to match.
[22772] Fix | Delete
results.map(result => {
[22773] Fix | Delete
if (Number(result.id) === pageOnFront) {
[22774] Fix | Delete
result.isFrontPage = true;
[22775] Fix | Delete
return result;
[22776] Fix | Delete
} else if (Number(result.id) === pageForPosts) {
[22777] Fix | Delete
result.isBlogHome = true;
[22778] Fix | Delete
return result;
[22779] Fix | Delete
}
[22780] Fix | Delete
return result;
[22781] Fix | Delete
});
[22782] Fix | Delete
[22783] Fix | Delete
// If displaying initial suggestions just return plain results.
[22784] Fix | Delete
if (isInitialSuggestions) {
[22785] Fix | Delete
return results;
[22786] Fix | Delete
}
[22787] Fix | Delete
[22788] Fix | Delete
// Here we append a faux suggestion to represent a "CREATE" option. This
[22789] Fix | Delete
// is detected in the rendering of the search results and handled as a
[22790] Fix | Delete
// special case. This is currently necessary because the suggestions
[22791] Fix | Delete
// dropdown will only appear if there are valid suggestions and
[22792] Fix | Delete
// therefore unless the create option is a suggestion it will not
[22793] Fix | Delete
// display in scenarios where there are no results returned from the
[22794] Fix | Delete
// API. In addition promoting CREATE to a first class suggestion affords
[22795] Fix | Delete
// the a11y benefits afforded by `URLInput` to all suggestions (eg:
[22796] Fix | Delete
// keyboard handling, ARIA roles...etc).
[22797] Fix | Delete
//
[22798] Fix | Delete
// Note also that the value of the `title` and `url` properties must correspond
[22799] Fix | Delete
// to the text value of the `<input>`. This is because `title` is used
[22800] Fix | Delete
// when creating the suggestion. Similarly `url` is used when using keyboard to select
[22801] Fix | Delete
// the suggestion (the <form> `onSubmit` handler falls-back to `url`).
[22802] Fix | Delete
return isURLLike(val) || !withCreateSuggestion ? results : results.concat({
[22803] Fix | Delete
// the `id` prop is intentionally ommitted here because it
[22804] Fix | Delete
// is never exposed as part of the component's public API.
[22805] Fix | Delete
// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.
[22806] Fix | Delete
title: val,
[22807] Fix | Delete
// Must match the existing `<input>`s text value.
[22808] Fix | Delete
url: val,
[22809] Fix | Delete
// Must match the existing `<input>`s text value.
[22810] Fix | Delete
type: CREATE_TYPE
[22811] Fix | Delete
});
[22812] Fix | Delete
};
[22813] Fix | Delete
function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) {
[22814] Fix | Delete
const {
[22815] Fix | Delete
fetchSearchSuggestions,
[22816] Fix | Delete
pageOnFront,
[22817] Fix | Delete
pageForPosts
[22818] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[22819] Fix | Delete
const {
[22820] Fix | Delete
getSettings
[22821] Fix | Delete
} = select(store);
[22822] Fix | Delete
return {
[22823] Fix | Delete
pageOnFront: getSettings().pageOnFront,
[22824] Fix | Delete
pageForPosts: getSettings().pageForPosts,
[22825] Fix | Delete
fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions
[22826] Fix | Delete
};
[22827] Fix | Delete
}, []);
[22828] Fix | Delete
const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop;
[22829] Fix | Delete
return (0,external_wp_element_namespaceObject.useCallback)((val, {
[22830] Fix | Delete
isInitialSuggestions
[22831] Fix | Delete
}) => {
[22832] Fix | Delete
return isURLLike(val) ? directEntryHandler(val, {
[22833] Fix | Delete
isInitialSuggestions
[22834] Fix | Delete
}) : handleEntitySearch(val, {
[22835] Fix | Delete
...suggestionsQuery,
[22836] Fix | Delete
isInitialSuggestions
[22837] Fix | Delete
}, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts);
[22838] Fix | Delete
}, [directEntryHandler, fetchSearchSuggestions, pageOnFront, pageForPosts, suggestionsQuery, withCreateSuggestion]);
[22839] Fix | Delete
}
[22840] Fix | Delete
[22841] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js
[22842] Fix | Delete
/**
[22843] Fix | Delete
* WordPress dependencies
[22844] Fix | Delete
*/
[22845] Fix | Delete
[22846] Fix | Delete
[22847] Fix | Delete
[22848] Fix | Delete
[22849] Fix | Delete
/**
[22850] Fix | Delete
* Internal dependencies
[22851] Fix | Delete
*/
[22852] Fix | Delete
[22853] Fix | Delete
[22854] Fix | Delete
[22855] Fix | Delete
[22856] Fix | Delete
[22857] Fix | Delete
// Must be a function as otherwise URLInput will default
[22858] Fix | Delete
// to the fetchLinkSuggestions passed in block editor settings
[22859] Fix | Delete
// which will cause an unintended http request.
[22860] Fix | Delete
[22861] Fix | Delete
[22862] Fix | Delete
const noopSearchHandler = () => Promise.resolve([]);
[22863] Fix | Delete
const noop = () => {};
[22864] Fix | Delete
const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)(({
[22865] Fix | Delete
value,
[22866] Fix | Delete
children,
[22867] Fix | Delete
currentLink = {},
[22868] Fix | Delete
className = null,
[22869] Fix | Delete
placeholder = null,
[22870] Fix | Delete
withCreateSuggestion = false,
[22871] Fix | Delete
onCreateSuggestion = noop,
[22872] Fix | Delete
onChange = noop,
[22873] Fix | Delete
onSelect = noop,
[22874] Fix | Delete
showSuggestions = true,
[22875] Fix | Delete
renderSuggestions = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, {
[22876] Fix | Delete
...props
[22877] Fix | Delete
}),
[22878] Fix | Delete
fetchSuggestions = null,
[22879] Fix | Delete
allowDirectEntry = true,
[22880] Fix | Delete
showInitialSuggestions = false,
[22881] Fix | Delete
suggestionsQuery = {},
[22882] Fix | Delete
withURLSuggestion = true,
[22883] Fix | Delete
createSuggestionButtonText,
[22884] Fix | Delete
hideLabelFromVision = false
[22885] Fix | Delete
}, ref) => {
[22886] Fix | Delete
const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion);
[22887] Fix | Delete
const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler;
[22888] Fix | Delete
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkControlSearchInput);
[22889] Fix | Delete
const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)();
[22890] Fix | Delete
[22891] Fix | Delete
/**
[22892] Fix | Delete
* Handles the user moving between different suggestions. Does not handle
[22893] Fix | Delete
* choosing an individual item.
[22894] Fix | Delete
*
[22895] Fix | Delete
* @param {string} selection the url of the selected suggestion.
[22896] Fix | Delete
* @param {Object} suggestion the suggestion object.
[22897] Fix | Delete
*/
[22898] Fix | Delete
const onInputChange = (selection, suggestion) => {
[22899] Fix | Delete
onChange(selection);
[22900] Fix | Delete
setFocusedSuggestion(suggestion);
[22901] Fix | Delete
};
[22902] Fix | Delete
const handleRenderSuggestions = props => renderSuggestions({
[22903] Fix | Delete
...props,
[22904] Fix | Delete
instanceId,
[22905] Fix | Delete
withCreateSuggestion,
[22906] Fix | Delete
createSuggestionButtonText,
[22907] Fix | Delete
suggestionsQuery,
[22908] Fix | Delete
handleSuggestionClick: suggestion => {
[22909] Fix | Delete
if (props.handleSuggestionClick) {
[22910] Fix | Delete
props.handleSuggestionClick(suggestion);
[22911] Fix | Delete
}
[22912] Fix | Delete
onSuggestionSelected(suggestion);
[22913] Fix | Delete
}
[22914] Fix | Delete
});
[22915] Fix | Delete
const onSuggestionSelected = async selectedSuggestion => {
[22916] Fix | Delete
let suggestion = selectedSuggestion;
[22917] Fix | Delete
if (CREATE_TYPE === selectedSuggestion.type) {
[22918] Fix | Delete
// Create a new page and call onSelect with the output from the onCreateSuggestion callback.
[22919] Fix | Delete
try {
[22920] Fix | Delete
suggestion = await onCreateSuggestion(selectedSuggestion.title);
[22921] Fix | Delete
if (suggestion?.url) {
[22922] Fix | Delete
onSelect(suggestion);
[22923] Fix | Delete
}
[22924] Fix | Delete
} catch (e) {}
[22925] Fix | Delete
return;
[22926] Fix | Delete
}
[22927] Fix | Delete
if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) {
[22928] Fix | Delete
const {
[22929] Fix | Delete
id,
[22930] Fix | Delete
url,
[22931] Fix | Delete
...restLinkProps
[22932] Fix | Delete
} = currentLink !== null && currentLink !== void 0 ? currentLink : {};
[22933] Fix | Delete
onSelect(
[22934] Fix | Delete
// Some direct entries don't have types or IDs, and we still need to clear the previous ones.
[22935] Fix | Delete
{
[22936] Fix | Delete
...restLinkProps,
[22937] Fix | Delete
...suggestion
[22938] Fix | Delete
}, suggestion);
[22939] Fix | Delete
}
[22940] Fix | Delete
};
[22941] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[22942] Fix | Delete
className: "block-editor-link-control__search-input-container",
[22943] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, {
[22944] Fix | Delete
disableSuggestions: currentLink?.url === value,
[22945] Fix | Delete
__nextHasNoMarginBottom: true,
[22946] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Link'),
[22947] Fix | Delete
hideLabelFromVision: hideLabelFromVision,
[22948] Fix | Delete
className: className,
[22949] Fix | Delete
value: value,
[22950] Fix | Delete
onChange: onInputChange,
[22951] Fix | Delete
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type URL'),
[22952] Fix | Delete
__experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null,
[22953] Fix | Delete
__experimentalFetchLinkSuggestions: searchHandler,
[22954] Fix | Delete
__experimentalHandleURLSuggestions: true,
[22955] Fix | Delete
__experimentalShowInitialSuggestions: showInitialSuggestions,
[22956] Fix | Delete
onSubmit: (suggestion, event) => {
[22957] Fix | Delete
const hasSuggestion = suggestion || focusedSuggestion;
[22958] Fix | Delete
[22959] Fix | Delete
// If there is no suggestion and the value (ie: any manually entered URL) is empty
[22960] Fix | Delete
// then don't allow submission otherwise we get empty links.
[22961] Fix | Delete
if (!hasSuggestion && !value?.trim()?.length) {
[22962] Fix | Delete
event.preventDefault();
[22963] Fix | Delete
} else {
[22964] Fix | Delete
onSuggestionSelected(hasSuggestion || {
[22965] Fix | Delete
url: value
[22966] Fix | Delete
});
[22967] Fix | Delete
}
[22968] Fix | Delete
},
[22969] Fix | Delete
ref: ref
[22970] Fix | Delete
}), children]
[22971] Fix | Delete
});
[22972] Fix | Delete
});
[22973] Fix | Delete
/* harmony default export */ const search_input = (LinkControlSearchInput);
[22974] Fix | Delete
[22975] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
[22976] Fix | Delete
/**
[22977] Fix | Delete
* WordPress dependencies
[22978] Fix | Delete
*/
[22979] Fix | Delete
[22980] Fix | Delete
[22981] Fix | Delete
const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[22982] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[22983] Fix | Delete
viewBox: "0 0 24 24",
[22984] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[22985] Fix | Delete
d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
[22986] Fix | Delete
})
[22987] Fix | Delete
});
[22988] Fix | Delete
/* harmony default export */ const library_info = (info);
[22989] Fix | Delete
[22990] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
[22991] Fix | Delete
/**
[22992] Fix | Delete
* WordPress dependencies
[22993] Fix | Delete
*/
[22994] Fix | Delete
[22995] Fix | Delete
[22996] Fix | Delete
const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[22997] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[22998] Fix | Delete
viewBox: "0 0 24 24",
[22999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function