: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
function CreateTemplatePartModal({
const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: modalTitle || defaultModalTitle,
onRequestClose: restProps.closeModal,
overlayClassName: "editor-create-template-part-modal",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, {
function CreateTemplatePartModalContents({
defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'),
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const existingTemplateParts = useExistingTemplateParts();
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle);
const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea);
const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetDefaultTemplatePartAreas(), []);
async function createTemplatePart() {
if (!title || isSubmitting) {
const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts);
const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, {
content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
await onCreate(templatePart);
// TODO: Add a success notice?
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
createErrorNotice(errorMessage, {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
onSubmit: async event => {
await createTemplatePart();
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Area'),
id: `editor-create-template-part-modal__area-selection-${instanceId}`,
className: "editor-create-template-part-modal__area-base-control",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Area'),
className: "editor-create-template-part-modal__area-radio-group",
id: `editor-create-template-part-modal__area-selection-${instanceId}`,
children: templatePartAreas.map(({
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadio, {
className: "editor-create-template-part-modal__area-radio",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexBlock, {
className: "editor-create-template-part-modal__option-label",
children: [label, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
className: "editor-create-template-part-modal__checkbox",
children: area === value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
"aria-disabled": !title || isSubmitting,
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
/* harmony default export */ const library_next = (next);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
/* harmony default export */ const library_previous = (previous);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function CollapsableBlockToolbar({
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()
const hasBlockToolbar = useHasBlockToolbar();
const hasBlockSelection = !!blockSelectionStart;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If we have a new block selection, show the block tools
if (blockSelectionStart) {
}, [blockSelectionStart, onToggle]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: dist_clsx('editor-collapsible-block-toolbar', {
'is-collapsed': isCollapsed || !hasBlockSelection
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "editor-collapsible-block-toolbar__toggle",
icon: isCollapsed ? library_next : library_previous,
label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools'),
/* harmony default export */ const collapsible_block_toolbar = (CollapsableBlockToolbar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
/* harmony default export */ const library_plus = (plus);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js
disableBlockTools = false
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
inserterSidebarToggleRef,
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_blockEditor_namespaceObject.store);
} = select(external_wp_preferences_namespaceObject.store);
getInserterSidebarToggleRef,
} = unlock(select(store_store));
getShortcutRepresentation
} = select(external_wp_keyboardShortcuts_namespaceObject.store);
} = select(external_wp_blockEditor_namespaceObject.store);
isInserterOpened: select(store_store).isInserterOpened(),
isListViewOpen: isListViewOpened(),
listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
listViewToggleRef: getListViewToggleRef(),
hasFixedToolbar: getSettings().hasFixedToolbar,
showIconLabels: get('core', 'showIconLabels'),
isDistractionFree: get('core', 'distractionFree'),
isVisualMode: getEditorMode() === 'visual',
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
const preventDefault = event => {
// Because the inserter behaves like a dialog,
// if the inserter is opened already then when we click on the toggle button
// then the initial click event will close the inserter and then be propagated
// to the inserter toggle and it will open it again.
// To prevent this we need to stop the propagation of the event.
// This won't be necessary when the inserter no longer behaves like a dialog.
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
/* translators: accessibility text for the editor toolbar */
const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]);
/* translators: button label text should, if possible, be under 16 characters. */
const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button');
const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close');
// Some plugins expect and use the `edit-post-header-toolbar` CSS class to
// find the toolbar and inject UI elements into it. This is not officially
// supported, but we're keeping it in the list of class names for backwards
(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
className: dist_clsx('editor-document-tools', 'edit-post-header-toolbar', className),
"aria-label": toolbarAriaLabel,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-document-tools__left",
children: [!isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
ref: inserterSidebarToggleRef,
as: external_wp_components_namespaceObject.Button,
className: "editor-document-tools__inserter-toggle",
isPressed: isInserterOpened,
onMouseDown: preventDefault,
disabled: disableBlockTools,
label: showIconLabels ? shortLabel : longLabel,
showTooltip: !showIconLabels,
"aria-expanded": isInserterOpened
}), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [isLargeViewport && !hasFixedToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
as: external_wp_blockEditor_namespaceObject.ToolSelector,
showTooltip: !showIconLabels,
variant: showIconLabels ? 'tertiary' : undefined,
disabled: disableBlockTools,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
showTooltip: !showIconLabels,
variant: showIconLabels ? 'tertiary' : undefined,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
showTooltip: !showIconLabels,
variant: showIconLabels ? 'tertiary' : undefined,
}), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
as: external_wp_components_namespaceObject.Button,
className: "editor-document-tools__document-overview-toggle",
disabled: disableBlockTools,
isPressed: isListViewOpen
/* translators: button label text should, if possible, be under 16 characters. */,
label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'),
shortcut: listViewShortcut,
showTooltip: !showIconLabels,
variant: showIconLabels ? 'tertiary' : undefined,
"aria-expanded": isListViewOpen,
/* harmony default export */ const document_tools = (DocumentTools);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
/* harmony default export */ const more_vertical = (moreVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js
function CopyContentMenuItem() {
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
} = (0,external_wp_data_namespaceObject.useSelect)(store_store);
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
const record = getEditedEntityRecord('postType', getCurrentPostType(), getCurrentPostId());
if (typeof record.content === 'function') {
return record.content(record);
} else if (record.blocks) {
return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
} else if (record.content) {
createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {