: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (!blockDisplayInformation?.title) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
selectBlock(contentLockingParent);
modifyContentLockBlock(contentLockingParent);
children: (0,external_wp_i18n_namespaceObject.__)('Unlock')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
className: "editor-content-only-settings-menu__description",
children: (0,external_wp_i18n_namespaceObject.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.')
function ContentOnlySettingsMenu() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
}) => selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenuItems, {
clientId: selectedClientIds[0],
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js
function useFallbackTemplateContent(slug, isCustom = false) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const templateId = getDefaultTemplateId({
return templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined;
function start_template_options_useStartPatterns(fallbackContent) {
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
const postId = getCurrentPostId();
const postType = getCurrentPostType();
const record = getEntityRecord('postType', postType, postId);
patterns: getBlockPatterns()
const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet);
// Duplicated from packages/block-library/src/pattern/edit.js.
function injectThemeAttributeInBlockTemplateContent(block) {
if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) {
block.innerBlocks = block.innerBlocks.map(innerBlock => {
if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) {
innerBlock.attributes.theme = currentThemeStylesheet;
if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
block.attributes.theme = currentThemeStylesheet;
return (0,external_wp_element_namespaceObject.useMemo)(() => {
// filter patterns that are supposed to be used in the current template being edited.
blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent),
title: (0,external_wp_i18n_namespaceObject.__)('Fallback content')
}, ...patterns.filter(pattern => {
return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType));
blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block))
}, [fallbackContent, slug, patterns]);
function start_template_options_PatternSelection({
const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType);
const blockPatterns = start_template_options_useStartPatterns(fallbackContent);
const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
blockPatterns: blockPatterns,
shownPatterns: shownBlockPatterns,
onClickPattern: (pattern, blocks) => {
const fallbackContent = useFallbackTemplateContent(slug, isCustom);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, {
className: "editor-start-template-options__modal",
title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
focusOnMount: "firstElement",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "editor-start-template-options__modal-content",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(start_template_options_PatternSelection, {
fallbackContent: fallbackContent,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
className: "editor-start-template-options__modal__actions",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
children: (0,external_wp_i18n_namespaceObject.__)('Skip')
function StartTemplateOptions() {
const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false);
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const _postType = getCurrentPostType();
const _postId = getCurrentPostId();
} = select(external_wp_coreData_namespaceObject.store);
const templateRecord = getEditedEntityRecord('postType', _postType, _postId);
const hasEdits = hasEditsForEntityRecord('postType', _postType, _postId);
shouldOpenModal: !hasEdits && '' === templateRecord.content && TEMPLATE_POST_TYPE === _postType,
slug: templateRecord.slug,
isCustom: templateRecord.is_custom,
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Should reset the modal state when navigating to a new page/post.
if (!shouldOpenModal || isClosed) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartModal, {
onClose: () => setIsClosed(true)
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
ExperimentalBlockEditorProvider
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
} = unlock(external_wp_patterns_namespaceObject.privateApis);
const provider_noop = () => {};
* These are global entities that are only there to split blocks into logical units
* They don't provide a "context" for the current post/page being rendered.
* So we should not use their ids as post context. This is important to allow post blocks
* (post content, post title) to be used within them without issues.
const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_template', 'wp_navigation', 'wp_template_part'];
* Depending on the post, template and template mode,
* returns the appropriate blocks and change handlers for the block editor provider.
* @param {Array} post Block list.
* @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.
* @param {string} mode Rendering mode.
* const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );
* @return {Array} Block editor props.
function useBlockEditorProps(post, template, mode) {
const rootLevelPost = mode === 'post-only' || !template ? 'post' : 'template';
const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, {
const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, {
const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (post.type === 'wp_navigation') {
return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', {
// As the parent editor is locked with `templateLock`, the template locking
// must be explicitly "unset" on the block itself to allow the user to modify
}, [post.type, post.id]);
// It is important that we don't create a new instance of blocks on every change
// We should only create a new instance if the blocks them selves change, not a dependency of them.
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (maybeNavigationBlocks) {
return maybeNavigationBlocks;
if (rootLevelPost === 'template') {
}, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]);
// Handle fallback to postBlocks outside of the above useMemo, to ensure
// that constructed block templates that call `createBlock` are not generated
// too frequently. This ensures that clientIds are stable.
const disableRootLevelChanges = !!template && mode === 'template-locked' || post.type === 'wp_navigation';
if (disableRootLevelChanges) {
return [blocks, provider_noop, provider_noop];
return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate];
* This component provides the editor context and manages the state of the block editor.
* @param {Object} props The component props.
* @param {Object} props.post The post object.
* @param {Object} props.settings The editor settings.
* @param {boolean} props.recovery Indicates if the editor is in recovery mode.
* @param {Array} props.initialEdits The initial edits for the editor.
* @param {Object} props.children The child components.
* @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.
* @param {Object} [props.__unstableTemplate] The template object.
* <ExperimentalEditorProvider
* initialEdits={ initialEdits }
* __unstableTemplate={ template }
* </ExperimentalEditorProvider>
* @return {Object} The rendered ExperimentalEditorProvider component.
const ExperimentalEditorProvider = with_registry_provider(({
BlockEditorProviderComponent = ExperimentalBlockEditorProvider,
__unstableTemplate: template
const mode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getRenderingMode(), []);
const shouldRenderTemplate = !!template && mode !== 'post-only';
const rootLevelPost = shouldRenderTemplate ? template : post;
const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => {
const postContext = !NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate ? {
templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined
}, [shouldRenderTemplate, post.id, post.type, rootLevelPost.type, rootLevelPost.slug]);
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
editorSettings: getEditorSettings(),
isReady: __unstableIsEditorReady(),
selection: getEditorSelection()
const blockEditorSettings = use_block_editor_settings(editorSettings, type, id, mode);
const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode);
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
// Ideally this should be synced on each change and not just something you do once.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
// Assume that we don't need to initialize in the case of an error recovery.
updatePostLock(settings.postLock);
setupEditor(post, initialEdits, settings.template);
createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), {
label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'),
url: settings.autosave.editLink
// Synchronizes the active post with the state
(0,external_wp_element_namespaceObject.useEffect)(() => {
setEditedPost(post.type, post.id);
}, [post.type, post.id, setEditedPost]);
// Synchronize the editor settings as they change.
(0,external_wp_element_namespaceObject.useEffect)(() => {
updateEditorSettings(settings);
}, [settings, updateEditorSettings]);
// Synchronizes the active template with the state.
(0,external_wp_element_namespaceObject.useEffect)(() => {
setCurrentTemplateId(template?.id);
}, [template?.id, setCurrentTemplateId]);
// Sets the right rendering mode when loading the editor.
(0,external_wp_element_namespaceObject.useEffect)(() => {
var _settings$defaultRend;
setRenderingMode((_settings$defaultRend = settings.defaultRenderingMode) !== null && _settings$defaultRend !== void 0 ? _settings$defaultRend : 'post-only');
}, [settings.defaultRenderingMode, setRenderingMode]);
useHideBlocksFromInserter(post.type, mode);
// Register the editor commands.
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
value: defaultBlockContext,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockEditorProviderComponent, {
settings: blockEditorSettings,
children: [children, !settings.__unstableIsPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), mode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), type === 'wp_navigation' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {})]
* This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).
* It supports a large number of post types, including post, page, templates,
* custom post types, patterns, template parts.
* All modification and changes are performed to the `@wordpress/core-data` store.
* @param {Object} props The component props.
* @param {Object} [props.post] The post object to edit. This is required.
* @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.
* This is optional and can only be used when the post type supports templates (like posts and pages).
* @param {Object} [props.settings] The settings object to use for the editor.