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
patternSourceFilter: patternSourceFilter,
[46500] Fix | Delete
setPatternSyncFilter: onSetPatternSyncFilter,
[46501] Fix | Delete
setPatternSourceFilter: onSetPatternSourceFilter,
[46502] Fix | Delete
scrollContainerRef: scrollContainerRef,
[46503] Fix | Delete
category: category
[46504] Fix | Delete
})]
[46505] Fix | Delete
}), !currentCategoryPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
[46506] Fix | Delete
variant: "muted",
[46507] Fix | Delete
className: "block-editor-inserter__patterns-category-no-results",
[46508] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('No results found')
[46509] Fix | Delete
})]
[46510] Fix | Delete
}), currentCategoryPatterns.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, {
[46511] Fix | Delete
ref: scrollContainerRef,
[46512] Fix | Delete
shownPatterns: pagingProps.categoryPatternsAsyncList,
[46513] Fix | Delete
blockPatterns: pagingProps.categoryPatterns,
[46514] Fix | Delete
onClickPattern: onClickPattern,
[46515] Fix | Delete
onHover: onHover,
[46516] Fix | Delete
label: category.label,
[46517] Fix | Delete
orientation: "vertical",
[46518] Fix | Delete
category: category.name,
[46519] Fix | Delete
isDraggable: true,
[46520] Fix | Delete
showTitlesAsTooltip: showTitlesAsTooltip,
[46521] Fix | Delete
patternFilter: patternSourceFilter,
[46522] Fix | Delete
pagingProps: pagingProps
[46523] Fix | Delete
})]
[46524] Fix | Delete
});
[46525] Fix | Delete
}
[46526] Fix | Delete
[46527] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js
[46528] Fix | Delete
/**
[46529] Fix | Delete
* WordPress dependencies
[46530] Fix | Delete
*/
[46531] Fix | Delete
[46532] Fix | Delete
[46533] Fix | Delete
[46534] Fix | Delete
[46535] Fix | Delete
/**
[46536] Fix | Delete
* Internal dependencies
[46537] Fix | Delete
*/
[46538] Fix | Delete
[46539] Fix | Delete
[46540] Fix | Delete
[46541] Fix | Delete
const {
[46542] Fix | Delete
Tabs: category_tabs_Tabs
[46543] Fix | Delete
} = unlock(external_wp_components_namespaceObject.privateApis);
[46544] Fix | Delete
function CategoryTabs({
[46545] Fix | Delete
categories,
[46546] Fix | Delete
selectedCategory,
[46547] Fix | Delete
onSelectCategory,
[46548] Fix | Delete
children
[46549] Fix | Delete
}) {
[46550] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(category_tabs_Tabs, {
[46551] Fix | Delete
className: "block-editor-inserter__category-tabs",
[46552] Fix | Delete
selectOnMove: false,
[46553] Fix | Delete
selectedTabId: selectedCategory ? selectedCategory.name : null,
[46554] Fix | Delete
orientation: "vertical",
[46555] Fix | Delete
onSelect: categoryId => {
[46556] Fix | Delete
// Pass the full category object
[46557] Fix | Delete
onSelectCategory(categories.find(category => category.name === categoryId));
[46558] Fix | Delete
},
[46559] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabList, {
[46560] Fix | Delete
className: "block-editor-inserter__category-tablist",
[46561] Fix | Delete
children: categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.Tab, {
[46562] Fix | Delete
tabId: category.name,
[46563] Fix | Delete
className: "block-editor-inserter__category-tab",
[46564] Fix | Delete
"aria-label": category.label,
[46565] Fix | Delete
"aria-current": category === selectedCategory ? 'true' : undefined,
[46566] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
[46567] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
[46568] Fix | Delete
children: category.label
[46569] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
[46570] Fix | Delete
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
[46571] Fix | Delete
})]
[46572] Fix | Delete
})
[46573] Fix | Delete
}, category.name))
[46574] Fix | Delete
}), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabPanel, {
[46575] Fix | Delete
tabId: category.name,
[46576] Fix | Delete
focusable: false,
[46577] Fix | Delete
className: "block-editor-inserter__category-panel",
[46578] Fix | Delete
children: children
[46579] Fix | Delete
}, category.name))]
[46580] Fix | Delete
});
[46581] Fix | Delete
}
[46582] Fix | Delete
/* harmony default export */ const category_tabs = (CategoryTabs);
[46583] Fix | Delete
[46584] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js
[46585] Fix | Delete
/**
[46586] Fix | Delete
* WordPress dependencies
[46587] Fix | Delete
*/
[46588] Fix | Delete
[46589] Fix | Delete
[46590] Fix | Delete
[46591] Fix | Delete
[46592] Fix | Delete
[46593] Fix | Delete
[46594] Fix | Delete
/**
[46595] Fix | Delete
* Internal dependencies
[46596] Fix | Delete
*/
[46597] Fix | Delete
[46598] Fix | Delete
[46599] Fix | Delete
[46600] Fix | Delete
[46601] Fix | Delete
[46602] Fix | Delete
[46603] Fix | Delete
[46604] Fix | Delete
[46605] Fix | Delete
[46606] Fix | Delete
[46607] Fix | Delete
[46608] Fix | Delete
function BlockPatternsTab({
[46609] Fix | Delete
onSelectCategory,
[46610] Fix | Delete
selectedCategory,
[46611] Fix | Delete
onInsert,
[46612] Fix | Delete
rootClientId,
[46613] Fix | Delete
children
[46614] Fix | Delete
}) {
[46615] Fix | Delete
const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false);
[46616] Fix | Delete
const categories = usePatternCategories(rootClientId);
[46617] Fix | Delete
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
[46618] Fix | Delete
const isResolvingPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).isResolvingPatterns(), []);
[46619] Fix | Delete
if (isResolvingPatterns) {
[46620] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[46621] Fix | Delete
className: "block-editor-inserter__patterns-loading",
[46622] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
[46623] Fix | Delete
});
[46624] Fix | Delete
}
[46625] Fix | Delete
if (!categories.length) {
[46626] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {});
[46627] Fix | Delete
}
[46628] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[46629] Fix | Delete
children: [!isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[46630] Fix | Delete
className: "block-editor-inserter__block-patterns-tabs-container",
[46631] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs, {
[46632] Fix | Delete
categories: categories,
[46633] Fix | Delete
selectedCategory: selectedCategory,
[46634] Fix | Delete
onSelectCategory: onSelectCategory,
[46635] Fix | Delete
children: children
[46636] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[46637] Fix | Delete
className: "block-editor-inserter__patterns-explore-button",
[46638] Fix | Delete
onClick: () => setShowPatternsExplorer(true),
[46639] Fix | Delete
variant: "secondary",
[46640] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Explore all patterns')
[46641] Fix | Delete
})]
[46642] Fix | Delete
}), isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, {
[46643] Fix | Delete
categories: categories,
[46644] Fix | Delete
children: category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[46645] Fix | Delete
className: "block-editor-inserter__category-panel",
[46646] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, {
[46647] Fix | Delete
onInsert: onInsert,
[46648] Fix | Delete
rootClientId: rootClientId,
[46649] Fix | Delete
category: category,
[46650] Fix | Delete
showTitlesAsTooltip: false
[46651] Fix | Delete
}, category.name)
[46652] Fix | Delete
})
[46653] Fix | Delete
}), showPatternsExplorer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_explorer, {
[46654] Fix | Delete
initialCategory: selectedCategory || categories[0],
[46655] Fix | Delete
patternCategories: categories,
[46656] Fix | Delete
onModalClose: () => setShowPatternsExplorer(false),
[46657] Fix | Delete
rootClientId: rootClientId
[46658] Fix | Delete
})]
[46659] Fix | Delete
});
[46660] Fix | Delete
}
[46661] Fix | Delete
/* harmony default export */ const block_patterns_tab = (BlockPatternsTab);
[46662] Fix | Delete
[46663] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js
[46664] Fix | Delete
/**
[46665] Fix | Delete
* Internal dependencies
[46666] Fix | Delete
*/
[46667] Fix | Delete
[46668] Fix | Delete
[46669] Fix | Delete
[46670] Fix | Delete
function PatternCategoryPreviewPanelInner({
[46671] Fix | Delete
rootClientId,
[46672] Fix | Delete
onInsert,
[46673] Fix | Delete
onHover,
[46674] Fix | Delete
category,
[46675] Fix | Delete
showTitlesAsTooltip,
[46676] Fix | Delete
patternFilter
[46677] Fix | Delete
}) {
[46678] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, {
[46679] Fix | Delete
rootClientId: rootClientId,
[46680] Fix | Delete
onInsert: onInsert,
[46681] Fix | Delete
onHover: onHover,
[46682] Fix | Delete
category: category,
[46683] Fix | Delete
showTitlesAsTooltip: showTitlesAsTooltip,
[46684] Fix | Delete
patternFilter: patternFilter
[46685] Fix | Delete
}, category.name);
[46686] Fix | Delete
}
[46687] Fix | Delete
function PatternCategoryPreviewPanelWithZoomOut(props) {
[46688] Fix | Delete
useZoomOut();
[46689] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelInner, {
[46690] Fix | Delete
...props
[46691] Fix | Delete
});
[46692] Fix | Delete
}
[46693] Fix | Delete
function PatternCategoryPreviewPanel(props) {
[46694] Fix | Delete
// When the pattern panel is showing, we want to use zoom out mode
[46695] Fix | Delete
if (window.__experimentalEnableZoomedOutPatternsTab) {
[46696] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelWithZoomOut, {
[46697] Fix | Delete
...props
[46698] Fix | Delete
});
[46699] Fix | Delete
}
[46700] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelInner, {
[46701] Fix | Delete
...props
[46702] Fix | Delete
});
[46703] Fix | Delete
}
[46704] Fix | Delete
[46705] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
[46706] Fix | Delete
/**
[46707] Fix | Delete
* WordPress dependencies
[46708] Fix | Delete
*/
[46709] Fix | Delete
[46710] Fix | Delete
[46711] Fix | Delete
const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
[46712] Fix | Delete
xmlns: "http://www.w3.org/2000/svg",
[46713] Fix | Delete
viewBox: "0 0 24 24",
[46714] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
[46715] Fix | Delete
d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
[46716] Fix | Delete
})
[46717] Fix | Delete
});
[46718] Fix | Delete
/* harmony default export */ const library_external = (external);
[46719] Fix | Delete
[46720] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js
[46721] Fix | Delete
/**
[46722] Fix | Delete
* WordPress dependencies
[46723] Fix | Delete
*/
[46724] Fix | Delete
[46725] Fix | Delete
[46726] Fix | Delete
const mediaTypeTag = {
[46727] Fix | Delete
image: 'img',
[46728] Fix | Delete
video: 'video',
[46729] Fix | Delete
audio: 'audio'
[46730] Fix | Delete
};
[46731] Fix | Delete
[46732] Fix | Delete
/** @typedef {import('./hooks').InserterMediaItem} InserterMediaItem */
[46733] Fix | Delete
[46734] Fix | Delete
/**
[46735] Fix | Delete
* Creates a block and a preview element from a media object.
[46736] Fix | Delete
*
[46737] Fix | Delete
* @param {InserterMediaItem} media The media object to create the block from.
[46738] Fix | Delete
* @param {('image'|'audio'|'video')} mediaType The media type to create the block for.
[46739] Fix | Delete
* @return {[WPBlock, JSX.Element]} An array containing the block and the preview element.
[46740] Fix | Delete
*/
[46741] Fix | Delete
function getBlockAndPreviewFromMedia(media, mediaType) {
[46742] Fix | Delete
// Add the common attributes between the different media types.
[46743] Fix | Delete
const attributes = {
[46744] Fix | Delete
id: media.id || undefined,
[46745] Fix | Delete
caption: media.caption || undefined
[46746] Fix | Delete
};
[46747] Fix | Delete
const mediaSrc = media.url;
[46748] Fix | Delete
const alt = media.alt || undefined;
[46749] Fix | Delete
if (mediaType === 'image') {
[46750] Fix | Delete
attributes.url = mediaSrc;
[46751] Fix | Delete
attributes.alt = alt;
[46752] Fix | Delete
} else if (['video', 'audio'].includes(mediaType)) {
[46753] Fix | Delete
attributes.src = mediaSrc;
[46754] Fix | Delete
}
[46755] Fix | Delete
const PreviewTag = mediaTypeTag[mediaType];
[46756] Fix | Delete
const preview = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTag, {
[46757] Fix | Delete
src: media.previewUrl || mediaSrc,
[46758] Fix | Delete
alt: alt,
[46759] Fix | Delete
controls: mediaType === 'audio' ? true : undefined,
[46760] Fix | Delete
inert: "true",
[46761] Fix | Delete
onError: ({
[46762] Fix | Delete
currentTarget
[46763] Fix | Delete
}) => {
[46764] Fix | Delete
// Fall back to the media source if the preview cannot be loaded.
[46765] Fix | Delete
if (currentTarget.src === media.previewUrl) {
[46766] Fix | Delete
currentTarget.src = mediaSrc;
[46767] Fix | Delete
}
[46768] Fix | Delete
}
[46769] Fix | Delete
});
[46770] Fix | Delete
return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/${mediaType}`, attributes), preview];
[46771] Fix | Delete
}
[46772] Fix | Delete
[46773] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js
[46774] Fix | Delete
/**
[46775] Fix | Delete
* External dependencies
[46776] Fix | Delete
*/
[46777] Fix | Delete
[46778] Fix | Delete
[46779] Fix | Delete
/**
[46780] Fix | Delete
* WordPress dependencies
[46781] Fix | Delete
*/
[46782] Fix | Delete
[46783] Fix | Delete
[46784] Fix | Delete
[46785] Fix | Delete
[46786] Fix | Delete
[46787] Fix | Delete
[46788] Fix | Delete
[46789] Fix | Delete
[46790] Fix | Delete
[46791] Fix | Delete
/**
[46792] Fix | Delete
* Internal dependencies
[46793] Fix | Delete
*/
[46794] Fix | Delete
[46795] Fix | Delete
[46796] Fix | Delete
[46797] Fix | Delete
[46798] Fix | Delete
[46799] Fix | Delete
[46800] Fix | Delete
[46801] Fix | Delete
const ALLOWED_MEDIA_TYPES = ['image'];
[46802] Fix | Delete
const MAXIMUM_TITLE_LENGTH = 25;
[46803] Fix | Delete
const MEDIA_OPTIONS_POPOVER_PROPS = {
[46804] Fix | Delete
position: 'bottom left',
[46805] Fix | Delete
className: 'block-editor-inserter__media-list__item-preview-options__popover'
[46806] Fix | Delete
};
[46807] Fix | Delete
const {
[46808] Fix | Delete
CompositeItemV2: media_preview_CompositeItem
[46809] Fix | Delete
} = unlock(external_wp_components_namespaceObject.privateApis);
[46810] Fix | Delete
function MediaPreviewOptions({
[46811] Fix | Delete
category,
[46812] Fix | Delete
media
[46813] Fix | Delete
}) {
[46814] Fix | Delete
if (!category.getReportUrl) {
[46815] Fix | Delete
return null;
[46816] Fix | Delete
}
[46817] Fix | Delete
const reportUrl = category.getReportUrl(media);
[46818] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
[46819] Fix | Delete
className: "block-editor-inserter__media-list__item-preview-options",
[46820] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Options'),
[46821] Fix | Delete
popoverProps: MEDIA_OPTIONS_POPOVER_PROPS,
[46822] Fix | Delete
icon: more_vertical,
[46823] Fix | Delete
children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
[46824] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
[46825] Fix | Delete
onClick: () => window.open(reportUrl, '_blank').focus(),
[46826] Fix | Delete
icon: library_external,
[46827] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The media type to report e.g: "image", "video", "audio" */
[46828] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Report %s'), category.mediaType)
[46829] Fix | Delete
})
[46830] Fix | Delete
})
[46831] Fix | Delete
});
[46832] Fix | Delete
}
[46833] Fix | Delete
function InsertExternalImageModal({
[46834] Fix | Delete
onClose,
[46835] Fix | Delete
onSubmit
[46836] Fix | Delete
}) {
[46837] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, {
[46838] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Insert external image'),
[46839] Fix | Delete
onRequestClose: onClose,
[46840] Fix | Delete
className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal",
[46841] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
[46842] Fix | Delete
spacing: 3,
[46843] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[46844] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.')
[46845] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
[46846] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.')
[46847] Fix | Delete
})]
[46848] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
[46849] Fix | Delete
className: "block-editor-block-lock-modal__actions",
[46850] Fix | Delete
justify: "flex-end",
[46851] Fix | Delete
expanded: false,
[46852] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
[46853] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[46854] Fix | Delete
variant: "tertiary",
[46855] Fix | Delete
onClick: onClose,
[46856] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
[46857] Fix | Delete
})
[46858] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
[46859] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[46860] Fix | Delete
variant: "primary",
[46861] Fix | Delete
onClick: onSubmit,
[46862] Fix | Delete
children: (0,external_wp_i18n_namespaceObject.__)('Insert')
[46863] Fix | Delete
})
[46864] Fix | Delete
})]
[46865] Fix | Delete
})]
[46866] Fix | Delete
});
[46867] Fix | Delete
}
[46868] Fix | Delete
function MediaPreview({
[46869] Fix | Delete
media,
[46870] Fix | Delete
onClick,
[46871] Fix | Delete
category
[46872] Fix | Delete
}) {
[46873] Fix | Delete
const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false);
[46874] Fix | Delete
const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
[46875] Fix | Delete
const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false);
[46876] Fix | Delete
const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)(() => getBlockAndPreviewFromMedia(media, category.mediaType), [media, category.mediaType]);
[46877] Fix | Delete
const {
[46878] Fix | Delete
createErrorNotice,
[46879] Fix | Delete
createSuccessNotice
[46880] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
[46881] Fix | Delete
const {
[46882] Fix | Delete
getSettings
[46883] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[46884] Fix | Delete
const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)(previewBlock => {
[46885] Fix | Delete
// Prevent multiple uploads when we're in the process of inserting.
[46886] Fix | Delete
if (isInserting) {
[46887] Fix | Delete
return;
[46888] Fix | Delete
}
[46889] Fix | Delete
const settings = getSettings();
[46890] Fix | Delete
const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock);
[46891] Fix | Delete
const {
[46892] Fix | Delete
id,
[46893] Fix | Delete
url,
[46894] Fix | Delete
caption
[46895] Fix | Delete
} = clonedBlock.attributes;
[46896] Fix | Delete
[46897] Fix | Delete
// User has no permission to upload media.
[46898] Fix | Delete
if (!id && !settings.mediaUpload) {
[46899] Fix | Delete
setShowExternalUploadModal(true);
[46900] Fix | Delete
return;
[46901] Fix | Delete
}
[46902] Fix | Delete
[46903] Fix | Delete
// Media item already exists in library, so just insert it.
[46904] Fix | Delete
if (!!id) {
[46905] Fix | Delete
onClick(clonedBlock);
[46906] Fix | Delete
return;
[46907] Fix | Delete
}
[46908] Fix | Delete
setIsInserting(true);
[46909] Fix | Delete
// Media item does not exist in library, so try to upload it.
[46910] Fix | Delete
// Fist fetch the image data. This may fail if the image host
[46911] Fix | Delete
// doesn't allow CORS with the domain.
[46912] Fix | Delete
// If this happens, we insert the image block using the external
[46913] Fix | Delete
// URL and let the user know about the possible implications.
[46914] Fix | Delete
window.fetch(url).then(response => response.blob()).then(blob => {
[46915] Fix | Delete
settings.mediaUpload({
[46916] Fix | Delete
filesList: [blob],
[46917] Fix | Delete
additionalData: {
[46918] Fix | Delete
caption
[46919] Fix | Delete
},
[46920] Fix | Delete
onFileChange([img]) {
[46921] Fix | Delete
if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) {
[46922] Fix | Delete
return;
[46923] Fix | Delete
}
[46924] Fix | Delete
onClick({
[46925] Fix | Delete
...clonedBlock,
[46926] Fix | Delete
attributes: {
[46927] Fix | Delete
...clonedBlock.attributes,
[46928] Fix | Delete
id: img.id,
[46929] Fix | Delete
url: img.url
[46930] Fix | Delete
}
[46931] Fix | Delete
});
[46932] Fix | Delete
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image uploaded and inserted.'), {
[46933] Fix | Delete
type: 'snackbar'
[46934] Fix | Delete
});
[46935] Fix | Delete
setIsInserting(false);
[46936] Fix | Delete
},
[46937] Fix | Delete
allowedTypes: ALLOWED_MEDIA_TYPES,
[46938] Fix | Delete
onError(message) {
[46939] Fix | Delete
createErrorNotice(message, {
[46940] Fix | Delete
type: 'snackbar'
[46941] Fix | Delete
});
[46942] Fix | Delete
setIsInserting(false);
[46943] Fix | Delete
}
[46944] Fix | Delete
});
[46945] Fix | Delete
}).catch(() => {
[46946] Fix | Delete
setShowExternalUploadModal(true);
[46947] Fix | Delete
setIsInserting(false);
[46948] Fix | Delete
});
[46949] Fix | Delete
}, [isInserting, getSettings, onClick, createSuccessNotice, createErrorNotice]);
[46950] Fix | Delete
const title = typeof media.title === 'string' ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('no title');
[46951] Fix | Delete
let truncatedTitle;
[46952] Fix | Delete
if (title.length > MAXIMUM_TITLE_LENGTH) {
[46953] Fix | Delete
const omission = '...';
[46954] Fix | Delete
truncatedTitle = title.slice(0, MAXIMUM_TITLE_LENGTH - omission.length) + omission;
[46955] Fix | Delete
}
[46956] Fix | Delete
const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []);
[46957] Fix | Delete
const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []);
[46958] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[46959] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, {
[46960] Fix | Delete
isEnabled: true,
[46961] Fix | Delete
blocks: [block],
[46962] Fix | Delete
children: ({
[46963] Fix | Delete
draggable,
[46964] Fix | Delete
onDragStart,
[46965] Fix | Delete
onDragEnd
[46966] Fix | Delete
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[46967] Fix | Delete
className: dist_clsx('block-editor-inserter__media-list__list-item', {
[46968] Fix | Delete
'is-hovered': isHovered
[46969] Fix | Delete
}),
[46970] Fix | Delete
draggable: draggable,
[46971] Fix | Delete
onDragStart: onDragStart,
[46972] Fix | Delete
onDragEnd: onDragEnd,
[46973] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[46974] Fix | Delete
onMouseEnter: onMouseEnter,
[46975] Fix | Delete
onMouseLeave: onMouseLeave,
[46976] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, {
[46977] Fix | Delete
text: truncatedTitle || title,
[46978] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_preview_CompositeItem, {
[46979] Fix | Delete
render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[46980] Fix | Delete
"aria-label": title,
[46981] Fix | Delete
role: "option",
[46982] Fix | Delete
className: "block-editor-inserter__media-list__item"
[46983] Fix | Delete
}),
[46984] Fix | Delete
onClick: () => onMediaInsert(block),
[46985] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[46986] Fix | Delete
className: "block-editor-inserter__media-list__item-preview",
[46987] Fix | Delete
children: [preview, isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[46988] Fix | Delete
className: "block-editor-inserter__media-list__item-preview-spinner",
[46989] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
[46990] Fix | Delete
})]
[46991] Fix | Delete
})
[46992] Fix | Delete
})
[46993] Fix | Delete
}), !isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPreviewOptions, {
[46994] Fix | Delete
category: category,
[46995] Fix | Delete
media: media
[46996] Fix | Delete
})]
[46997] Fix | Delete
})
[46998] Fix | Delete
})
[46999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function