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
onSelect: media => selectMedia(media, onClose),
[24000] Fix | Delete
allowedTypes: allowedTypes,
[24001] Fix | Delete
render: ({
[24002] Fix | Delete
open
[24003] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[24004] Fix | Delete
icon: library_media,
[24005] Fix | Delete
onClick: open,
[24006] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Open Media Library')
[24007] Fix | Delete
})
[24008] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, {
[24009] Fix | Delete
onChange: event => {
[24010] Fix | Delete
uploadFiles(event, onClose);
[24011] Fix | Delete
},
[24012] Fix | Delete
accept: accept,
[24013] Fix | Delete
multiple: !!multiple,
[24014] Fix | Delete
render: ({
[24015] Fix | Delete
openFileDialog
[24016] Fix | Delete
}) => {
[24017] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[24018] Fix | Delete
icon: library_upload,
[24019] Fix | Delete
onClick: () => {
[24020] Fix | Delete
openFileDialog();
[24021] Fix | Delete
},
[24022] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Upload')
[24023] Fix | Delete
});
[24024] Fix | Delete
}
[24025] Fix | Delete
})]
[24026] Fix | Delete
}), onToggleFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[24027] Fix | Delete
icon: post_featured_image,
[24028] Fix | Delete
onClick: onToggleFeaturedImage,
[24029] Fix | Delete
isPressed: useFeaturedImage,
[24030] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Use featured image')
[24031] Fix | Delete
}), children]
[24032] Fix | Delete
}), onSelectURL &&
[24033] Fix | Delete
/*#__PURE__*/
[24034] Fix | Delete
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
[24035] Fix | Delete
(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", {
[24036] Fix | Delete
className: dist_clsx('block-editor-media-flow__url-input', {
[24037] Fix | Delete
'has-siblings': canUpload || onToggleFeaturedImage
[24038] Fix | Delete
}),
[24039] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[24040] Fix | Delete
className: "block-editor-media-replace-flow__image-url-label",
[24041] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Current media URL:')
[24042] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(link_control, {
[24043] Fix | Delete
value: {
[24044] Fix | Delete
url: mediaURL
[24045] Fix | Delete
},
[24046] Fix | Delete
settings: [],
[24047] Fix | Delete
showSuggestions: false,
[24048] Fix | Delete
onChange: ({
[24049] Fix | Delete
url
[24050] Fix | Delete
}) => {
[24051] Fix | Delete
onSelectURL(url);
[24052] Fix | Delete
editMediaButtonRef.current.focus();
[24053] Fix | Delete
}
[24054] Fix | Delete
})]
[24055] Fix | Delete
})]
[24056] Fix | Delete
})
[24057] Fix | Delete
});
[24058] Fix | Delete
};
[24059] Fix | Delete
[24060] Fix | Delete
/**
[24061] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-replace-flow/README.md
[24062] Fix | Delete
*/
[24063] Fix | Delete
/* harmony default export */ const media_replace_flow = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
[24064] Fix | Delete
const {
[24065] Fix | Delete
createNotice,
[24066] Fix | Delete
removeNotice
[24067] Fix | Delete
} = dispatch(external_wp_notices_namespaceObject.store);
[24068] Fix | Delete
return {
[24069] Fix | Delete
createNotice,
[24070] Fix | Delete
removeNotice
[24071] Fix | Delete
};
[24072] Fix | Delete
}), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow));
[24073] Fix | Delete
[24074] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/theme-file-uri-utils.js
[24075] Fix | Delete
/**
[24076] Fix | Delete
* Internal dependencies
[24077] Fix | Delete
*/
[24078] Fix | Delete
[24079] Fix | Delete
[24080] Fix | Delete
/**
[24081] Fix | Delete
* Looks up a theme file URI based on a relative path.
[24082] Fix | Delete
*
[24083] Fix | Delete
* @param {string} file A relative path.
[24084] Fix | Delete
* @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.
[24085] Fix | Delete
* @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection.
[24086] Fix | Delete
*/
[24087] Fix | Delete
function getResolvedThemeFilePath(file, themeFileURIs = []) {
[24088] Fix | Delete
const uri = themeFileURIs.find(themeFileUri => themeFileUri.name === file);
[24089] Fix | Delete
if (!uri?.href) {
[24090] Fix | Delete
return file;
[24091] Fix | Delete
}
[24092] Fix | Delete
return uri?.href;
[24093] Fix | Delete
}
[24094] Fix | Delete
[24095] Fix | Delete
/**
[24096] Fix | Delete
* Mutates an object by settings a value at the provided path.
[24097] Fix | Delete
*
[24098] Fix | Delete
* @param {Object} object Object to set a value in.
[24099] Fix | Delete
* @param {number|string|Array} path Path in the object to modify.
[24100] Fix | Delete
* @param {*} value New value to set.
[24101] Fix | Delete
* @return {Object} Object with the new value set.
[24102] Fix | Delete
*/
[24103] Fix | Delete
function setMutably(object, path, value) {
[24104] Fix | Delete
path = path.split('.');
[24105] Fix | Delete
const finalValueKey = path.pop();
[24106] Fix | Delete
let prev = object;
[24107] Fix | Delete
for (const key of path) {
[24108] Fix | Delete
const current = prev[key];
[24109] Fix | Delete
prev = current;
[24110] Fix | Delete
}
[24111] Fix | Delete
prev[finalValueKey] = value;
[24112] Fix | Delete
return object;
[24113] Fix | Delete
}
[24114] Fix | Delete
[24115] Fix | Delete
/**
[24116] Fix | Delete
* Resolves any relative paths if a corresponding theme file URI is available.
[24117] Fix | Delete
* Note: this function mutates the object and is specifically to be used in
[24118] Fix | Delete
* an async styles build context in useGlobalStylesOutput
[24119] Fix | Delete
*
[24120] Fix | Delete
* @param {Object} themeJson Theme.json/Global styles tree.
[24121] Fix | Delete
* @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.
[24122] Fix | Delete
* @return {Object} Returns mutated object.
[24123] Fix | Delete
*/
[24124] Fix | Delete
function setThemeFileUris(themeJson, themeFileURIs) {
[24125] Fix | Delete
if (!themeJson?.styles || !themeFileURIs) {
[24126] Fix | Delete
return themeJson;
[24127] Fix | Delete
}
[24128] Fix | Delete
themeFileURIs.forEach(({
[24129] Fix | Delete
name,
[24130] Fix | Delete
href,
[24131] Fix | Delete
target
[24132] Fix | Delete
}) => {
[24133] Fix | Delete
const value = getValueFromObjectPath(themeJson, target);
[24134] Fix | Delete
if (value === name) {
[24135] Fix | Delete
/*
[24136] Fix | Delete
* The object must not be updated immutably here because the
[24137] Fix | Delete
* themeJson is a reference to the global styles tree used as a dependency in the
[24138] Fix | Delete
* useGlobalStylesOutputWithConfig() hook. If we don't mutate the object,
[24139] Fix | Delete
* the hook will detect the change and re-render the component, resulting
[24140] Fix | Delete
* in a maximum depth exceeded error.
[24141] Fix | Delete
*/
[24142] Fix | Delete
themeJson = setMutably(themeJson, target, href);
[24143] Fix | Delete
}
[24144] Fix | Delete
});
[24145] Fix | Delete
return themeJson;
[24146] Fix | Delete
}
[24147] Fix | Delete
[24148] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js
[24149] Fix | Delete
/**
[24150] Fix | Delete
* External dependencies
[24151] Fix | Delete
*/
[24152] Fix | Delete
[24153] Fix | Delete
[24154] Fix | Delete
/**
[24155] Fix | Delete
* WordPress dependencies
[24156] Fix | Delete
*/
[24157] Fix | Delete
[24158] Fix | Delete
[24159] Fix | Delete
[24160] Fix | Delete
[24161] Fix | Delete
[24162] Fix | Delete
[24163] Fix | Delete
[24164] Fix | Delete
[24165] Fix | Delete
[24166] Fix | Delete
/**
[24167] Fix | Delete
* Internal dependencies
[24168] Fix | Delete
*/
[24169] Fix | Delete
[24170] Fix | Delete
[24171] Fix | Delete
[24172] Fix | Delete
[24173] Fix | Delete
[24174] Fix | Delete
[24175] Fix | Delete
[24176] Fix | Delete
const IMAGE_BACKGROUND_TYPE = 'image';
[24177] Fix | Delete
const background_panel_DEFAULT_CONTROLS = {
[24178] Fix | Delete
backgroundImage: true,
[24179] Fix | Delete
backgroundSize: false
[24180] Fix | Delete
};
[24181] Fix | Delete
[24182] Fix | Delete
/**
[24183] Fix | Delete
* Checks site settings to see if the background panel may be used.
[24184] Fix | Delete
* `settings.background.backgroundSize` exists also,
[24185] Fix | Delete
* but can only be used if settings?.background?.backgroundImage is `true`.
[24186] Fix | Delete
*
[24187] Fix | Delete
* @param {Object} settings Site settings
[24188] Fix | Delete
* @return {boolean} Whether site settings has activated background panel.
[24189] Fix | Delete
*/
[24190] Fix | Delete
function useHasBackgroundPanel(settings) {
[24191] Fix | Delete
return external_wp_element_namespaceObject.Platform.OS === 'web' && settings?.background?.backgroundImage;
[24192] Fix | Delete
}
[24193] Fix | Delete
[24194] Fix | Delete
/**
[24195] Fix | Delete
* Checks if there is a current value in the background size block support
[24196] Fix | Delete
* attributes. Background size values include background size as well
[24197] Fix | Delete
* as background position.
[24198] Fix | Delete
*
[24199] Fix | Delete
* @param {Object} style Style attribute.
[24200] Fix | Delete
* @return {boolean} Whether the block has a background size value set.
[24201] Fix | Delete
*/
[24202] Fix | Delete
function hasBackgroundSizeValue(style) {
[24203] Fix | Delete
return style?.background?.backgroundPosition !== undefined || style?.background?.backgroundSize !== undefined;
[24204] Fix | Delete
}
[24205] Fix | Delete
[24206] Fix | Delete
/**
[24207] Fix | Delete
* Checks if there is a current value in the background image block support
[24208] Fix | Delete
* attributes.
[24209] Fix | Delete
*
[24210] Fix | Delete
* @param {Object} style Style attribute.
[24211] Fix | Delete
* @return {boolean} Whether the block has a background image value set.
[24212] Fix | Delete
*/
[24213] Fix | Delete
function hasBackgroundImageValue(style) {
[24214] Fix | Delete
return !!style?.background?.backgroundImage?.id ||
[24215] Fix | Delete
// Supports url() string values in theme.json.
[24216] Fix | Delete
'string' === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url;
[24217] Fix | Delete
}
[24218] Fix | Delete
[24219] Fix | Delete
/**
[24220] Fix | Delete
* Get the help text for the background size control.
[24221] Fix | Delete
*
[24222] Fix | Delete
* @param {string} value backgroundSize value.
[24223] Fix | Delete
* @return {string} Translated help text.
[24224] Fix | Delete
*/
[24225] Fix | Delete
function backgroundSizeHelpText(value) {
[24226] Fix | Delete
if (value === 'cover' || value === undefined) {
[24227] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.');
[24228] Fix | Delete
}
[24229] Fix | Delete
if (value === 'contain') {
[24230] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.');
[24231] Fix | Delete
}
[24232] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Image has a fixed width.');
[24233] Fix | Delete
}
[24234] Fix | Delete
[24235] Fix | Delete
/**
[24236] Fix | Delete
* Converts decimal x and y coords from FocalPointPicker to percentage-based values
[24237] Fix | Delete
* to use as backgroundPosition value.
[24238] Fix | Delete
*
[24239] Fix | Delete
* @param {{x?:number, y?:number}} value FocalPointPicker coords.
[24240] Fix | Delete
* @return {string} backgroundPosition value.
[24241] Fix | Delete
*/
[24242] Fix | Delete
const coordsToBackgroundPosition = value => {
[24243] Fix | Delete
if (!value || isNaN(value.x) && isNaN(value.y)) {
[24244] Fix | Delete
return undefined;
[24245] Fix | Delete
}
[24246] Fix | Delete
const x = isNaN(value.x) ? 0.5 : value.x;
[24247] Fix | Delete
const y = isNaN(value.y) ? 0.5 : value.y;
[24248] Fix | Delete
return `${x * 100}% ${y * 100}%`;
[24249] Fix | Delete
};
[24250] Fix | Delete
[24251] Fix | Delete
/**
[24252] Fix | Delete
* Converts backgroundPosition value to x and y coords for FocalPointPicker.
[24253] Fix | Delete
*
[24254] Fix | Delete
* @param {string} value backgroundPosition value.
[24255] Fix | Delete
* @return {{x?:number, y?:number}} FocalPointPicker coords.
[24256] Fix | Delete
*/
[24257] Fix | Delete
const backgroundPositionToCoords = value => {
[24258] Fix | Delete
if (!value) {
[24259] Fix | Delete
return {
[24260] Fix | Delete
x: undefined,
[24261] Fix | Delete
y: undefined
[24262] Fix | Delete
};
[24263] Fix | Delete
}
[24264] Fix | Delete
let [x, y] = value.split(' ').map(v => parseFloat(v) / 100);
[24265] Fix | Delete
x = isNaN(x) ? undefined : x;
[24266] Fix | Delete
y = isNaN(y) ? x : y;
[24267] Fix | Delete
return {
[24268] Fix | Delete
x,
[24269] Fix | Delete
y
[24270] Fix | Delete
};
[24271] Fix | Delete
};
[24272] Fix | Delete
function InspectorImagePreview({
[24273] Fix | Delete
label,
[24274] Fix | Delete
filename,
[24275] Fix | Delete
url: imgUrl
[24276] Fix | Delete
}) {
[24277] Fix | Delete
const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)('Add background image');
[24278] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
[24279] Fix | Delete
as: "span",
[24280] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[24281] Fix | Delete
justify: imgUrl ? 'flex-start' : 'center',
[24282] Fix | Delete
as: "span",
[24283] Fix | Delete
children: [imgUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[24284] Fix | Delete
className: dist_clsx('block-editor-global-styles-background-panel__inspector-image-indicator-wrapper', {
[24285] Fix | Delete
'has-image': imgUrl
[24286] Fix | Delete
}),
[24287] Fix | Delete
"aria-hidden": true,
[24288] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
[24289] Fix | Delete
className: "block-editor-global-styles-background-panel__inspector-image-indicator",
[24290] Fix | Delete
style: {
[24291] Fix | Delete
backgroundImage: `url(${imgUrl})`
[24292] Fix | Delete
}
[24293] Fix | Delete
})
[24294] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, {
[24295] Fix | Delete
as: "span",
[24296] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, {
[24297] Fix | Delete
numberOfLines: 1,
[24298] Fix | Delete
className: "block-editor-global-styles-background-panel__inspector-media-replace-title",
[24299] Fix | Delete
children: imgLabel
[24300] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
[24301] Fix | Delete
as: "span",
[24302] Fix | Delete
children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */
[24303] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Background image: %s'), filename || imgLabel) : (0,external_wp_i18n_namespaceObject.__)('No background image selected')
[24304] Fix | Delete
})]
[24305] Fix | Delete
})]
[24306] Fix | Delete
})
[24307] Fix | Delete
});
[24308] Fix | Delete
}
[24309] Fix | Delete
function BackgroundImageToolsPanelItem({
[24310] Fix | Delete
panelId,
[24311] Fix | Delete
isShownByDefault,
[24312] Fix | Delete
onChange,
[24313] Fix | Delete
style,
[24314] Fix | Delete
inheritedValue,
[24315] Fix | Delete
themeFileURIs
[24316] Fix | Delete
}) {
[24317] Fix | Delete
const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().mediaUpload, []);
[24318] Fix | Delete
const {
[24319] Fix | Delete
id,
[24320] Fix | Delete
title,
[24321] Fix | Delete
url
[24322] Fix | Delete
} = style?.background?.backgroundImage || {
[24323] Fix | Delete
...inheritedValue?.background?.backgroundImage
[24324] Fix | Delete
};
[24325] Fix | Delete
const replaceContainerRef = (0,external_wp_element_namespaceObject.useRef)();
[24326] Fix | Delete
const {
[24327] Fix | Delete
createErrorNotice
[24328] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[24329] Fix | Delete
const onUploadError = message => {
[24330] Fix | Delete
createErrorNotice(message, {
[24331] Fix | Delete
type: 'snackbar'
[24332] Fix | Delete
});
[24333] Fix | Delete
};
[24334] Fix | Delete
const resetBackgroundImage = () => onChange(setImmutably(style, ['background', 'backgroundImage'], undefined));
[24335] Fix | Delete
const onSelectMedia = media => {
[24336] Fix | Delete
if (!media || !media.url) {
[24337] Fix | Delete
resetBackgroundImage();
[24338] Fix | Delete
return;
[24339] Fix | Delete
}
[24340] Fix | Delete
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
[24341] Fix | Delete
return;
[24342] Fix | Delete
}
[24343] Fix | Delete
[24344] Fix | Delete
// For media selections originated from a file upload.
[24345] Fix | Delete
if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) {
[24346] Fix | Delete
onUploadError((0,external_wp_i18n_namespaceObject.__)('Only images can be used as a background image.'));
[24347] Fix | Delete
return;
[24348] Fix | Delete
}
[24349] Fix | Delete
const sizeValue = style?.background?.backgroundSize;
[24350] Fix | Delete
const positionValue = style?.background?.backgroundPosition;
[24351] Fix | Delete
onChange(setImmutably(style, ['background'], {
[24352] Fix | Delete
...style?.background,
[24353] Fix | Delete
backgroundImage: {
[24354] Fix | Delete
url: media.url,
[24355] Fix | Delete
id: media.id,
[24356] Fix | Delete
source: 'file',
[24357] Fix | Delete
title: media.title || undefined
[24358] Fix | Delete
},
[24359] Fix | Delete
backgroundPosition: !positionValue && ('auto' === sizeValue || !sizeValue) ? '50% 0' : positionValue
[24360] Fix | Delete
}));
[24361] Fix | Delete
};
[24362] Fix | Delete
const onFilesDrop = filesList => {
[24363] Fix | Delete
mediaUpload({
[24364] Fix | Delete
allowedTypes: [IMAGE_BACKGROUND_TYPE],
[24365] Fix | Delete
filesList,
[24366] Fix | Delete
onFileChange([image]) {
[24367] Fix | Delete
if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
[24368] Fix | Delete
return;
[24369] Fix | Delete
}
[24370] Fix | Delete
onSelectMedia(image);
[24371] Fix | Delete
},
[24372] Fix | Delete
onError: onUploadError
[24373] Fix | Delete
});
[24374] Fix | Delete
};
[24375] Fix | Delete
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
[24376] Fix | Delete
return {
[24377] Fix | Delete
...previousValue,
[24378] Fix | Delete
style: {
[24379] Fix | Delete
...previousValue.style,
[24380] Fix | Delete
background: undefined
[24381] Fix | Delete
}
[24382] Fix | Delete
};
[24383] Fix | Delete
}, []);
[24384] Fix | Delete
const hasValue = hasBackgroundImageValue(style);
[24385] Fix | Delete
const closeAndFocus = () => {
[24386] Fix | Delete
const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(replaceContainerRef.current);
[24387] Fix | Delete
// Focus the toggle button and close the dropdown menu.
[24388] Fix | Delete
// This ensures similar behaviour as to selecting an image, where the dropdown is
[24389] Fix | Delete
// closed and focus is redirected to the dropdown toggle button.
[24390] Fix | Delete
toggleButton?.focus();
[24391] Fix | Delete
toggleButton?.click();
[24392] Fix | Delete
};
[24393] Fix | Delete
const onRemove = () => onChange(setImmutably(style, ['background', 'backgroundImage'], 'none'));
[24394] Fix | Delete
const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue);
[24395] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
[24396] Fix | Delete
className: "single-column",
[24397] Fix | Delete
hasValue: () => hasValue,
[24398] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Background image'),
[24399] Fix | Delete
onDeselect: resetBackgroundImage,
[24400] Fix | Delete
isShownByDefault: isShownByDefault,
[24401] Fix | Delete
resetAllFilter: resetAllFilter,
[24402] Fix | Delete
panelId: panelId,
[24403] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[24404] Fix | Delete
className: "block-editor-global-styles-background-panel__inspector-media-replace-container",
[24405] Fix | Delete
ref: replaceContainerRef,
[24406] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(media_replace_flow, {
[24407] Fix | Delete
mediaId: id,
[24408] Fix | Delete
mediaURL: url,
[24409] Fix | Delete
allowedTypes: [IMAGE_BACKGROUND_TYPE],
[24410] Fix | Delete
accept: "image/*",
[24411] Fix | Delete
onSelect: onSelectMedia,
[24412] Fix | Delete
name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorImagePreview, {
[24413] Fix | Delete
label: title,
[24414] Fix | Delete
filename: title,
[24415] Fix | Delete
url: getResolvedThemeFilePath(url, themeFileURIs)
[24416] Fix | Delete
}),
[24417] Fix | Delete
variant: "secondary",
[24418] Fix | Delete
children: [canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[24419] Fix | Delete
onClick: () => {
[24420] Fix | Delete
closeAndFocus();
[24421] Fix | Delete
onRemove();
[24422] Fix | Delete
},
[24423] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Remove')
[24424] Fix | Delete
}), hasValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[24425] Fix | Delete
onClick: () => {
[24426] Fix | Delete
closeAndFocus();
[24427] Fix | Delete
resetBackgroundImage();
[24428] Fix | Delete
},
[24429] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Reset ')
[24430] Fix | Delete
})]
[24431] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, {
[24432] Fix | Delete
onFilesDrop: onFilesDrop,
[24433] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Drop to upload')
[24434] Fix | Delete
})]
[24435] Fix | Delete
})
[24436] Fix | Delete
});
[24437] Fix | Delete
}
[24438] Fix | Delete
function BackgroundSizeToolsPanelItem({
[24439] Fix | Delete
panelId,
[24440] Fix | Delete
isShownByDefault,
[24441] Fix | Delete
onChange,
[24442] Fix | Delete
style,
[24443] Fix | Delete
inheritedValue,
[24444] Fix | Delete
defaultValues,
[24445] Fix | Delete
themeFileURIs
[24446] Fix | Delete
}) {
[24447] Fix | Delete
const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize;
[24448] Fix | Delete
const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
[24449] Fix | Delete
const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
[24450] Fix | Delete
const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
[24451] Fix | Delete
[24452] Fix | Delete
/*
[24453] Fix | Delete
* An `undefined` value is replaced with any supplied
[24454] Fix | Delete
* default control value for the toggle group control.
[24455] Fix | Delete
* An empty string is treated as `auto` - this allows a user
[24456] Fix | Delete
* to select "Size" and then enter a custom value, with an
[24457] Fix | Delete
* empty value being treated as `auto`.
[24458] Fix | Delete
*/
[24459] Fix | Delete
const currentValueForToggle = sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' || sizeValue === '' ? 'auto' : sizeValue || defaultValues?.backgroundSize;
[24460] Fix | Delete
[24461] Fix | Delete
/*
[24462] Fix | Delete
* If the current value is `cover` and the repeat value is `undefined`, then
[24463] Fix | Delete
* the toggle should be unchecked as the default state. Otherwise, the toggle
[24464] Fix | Delete
* should reflect the current repeat value.
[24465] Fix | Delete
*/
[24466] Fix | Delete
const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined);
[24467] Fix | Delete
const hasValue = hasBackgroundSizeValue(style);
[24468] Fix | Delete
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
[24469] Fix | Delete
return {
[24470] Fix | Delete
...previousValue,
[24471] Fix | Delete
style: {
[24472] Fix | Delete
...previousValue.style,
[24473] Fix | Delete
background: {
[24474] Fix | Delete
...previousValue.style?.background,
[24475] Fix | Delete
backgroundRepeat: undefined,
[24476] Fix | Delete
backgroundSize: undefined
[24477] Fix | Delete
}
[24478] Fix | Delete
}
[24479] Fix | Delete
};
[24480] Fix | Delete
}, []);
[24481] Fix | Delete
const updateBackgroundSize = next => {
[24482] Fix | Delete
// When switching to 'contain' toggle the repeat off.
[24483] Fix | Delete
let nextRepeat = repeatValue;
[24484] Fix | Delete
let nextPosition = positionValue;
[24485] Fix | Delete
if (next === 'contain') {
[24486] Fix | Delete
nextRepeat = 'no-repeat';
[24487] Fix | Delete
nextPosition = undefined;
[24488] Fix | Delete
}
[24489] Fix | Delete
if (next === 'cover') {
[24490] Fix | Delete
nextRepeat = undefined;
[24491] Fix | Delete
nextPosition = undefined;
[24492] Fix | Delete
}
[24493] Fix | Delete
if ((currentValueForToggle === 'cover' || currentValueForToggle === 'contain') && next === 'auto') {
[24494] Fix | Delete
nextRepeat = undefined;
[24495] Fix | Delete
/*
[24496] Fix | Delete
* A background image uploaded and set in the editor (an image with a record id),
[24497] Fix | Delete
* receives a default background position of '50% 0',
[24498] Fix | Delete
* when the toggle switches to "Tile". This is to increase the chance that
[24499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function