: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Triggers an action used to toggle a feature flag.
* @param {string} feature Feature name.
const toggleFeature = feature => ({
}) => registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature);
* Triggers an action used to switch editor mode.
* @param {string} mode The editor mode.
const switchEditorMode = mode => ({
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).switchEditorMode", {
alternative: "dispatch( 'core/editor').switchEditorMode"
registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode);
* Triggers an action object used to toggle a plugin name flag.
* @param {string} pluginName Plugin name.
const togglePinnedPluginItem = pluginName => ({
const isPinned = registry.select(interfaceStore).isItemPinned('core', pluginName);
registry.dispatch(interfaceStore)[isPinned ? 'unpinItem' : 'pinItem']('core', pluginName);
* Returns an action object used in signaling that a style should be auto-applied when a block is created.
function updatePreferredStyleVariations() {
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", {
hint: 'Preferred Style Variations are not supported anymore.'
* Update the provided block types to be visible.
* @param {string[]} blockNames Names of block types to show.
const showBlockTypes = blockNames => ({
unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).showBlockTypes(blockNames);
* Update the provided block types to be hidden.
* @param {string[]} blockNames Names of block types to hide.
const hideBlockTypes = blockNames => ({
unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).hideBlockTypes(blockNames);
* Stores info about which Meta boxes are available in which location.
* @param {Object} metaBoxesPerLocation Meta boxes per location.
function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
type: 'SET_META_BOXES_PER_LOCATIONS',
const requestMetaBoxUpdates = () => async ({
type: 'REQUEST_META_BOX_UPDATES'
// Saves the wp_editor fields.
window.tinyMCE.triggerSave();
// We gather the base form data.
const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
const postId = baseFormData.get('post_ID');
const postType = baseFormData.get('post_type');
// Additional data needed for backward compatibility.
// If we do not provide this data, the post will be overridden with the default values.
// We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template.
// We need to retrieve the post that the base form data is referring to.
const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean);
// We gather all the metaboxes locations.
const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))];
// Merge all form data objects into a single one.
const formData = formDataToMerge.reduce((memo, currentFormData) => {
for (const [key, value] of currentFormData) {
}, new window.FormData());
additionalData.forEach(([key, value]) => formData.append(key, value));
await external_wp_apiFetch_default()({
url: window._wpMetaBoxUrl,
dispatch.metaBoxUpdatesSuccess();
dispatch.metaBoxUpdatesFailure();
* Returns an action object used to signal a successful meta box update.
* @return {Object} Action object.
function metaBoxUpdatesSuccess() {
type: 'META_BOX_UPDATES_SUCCESS'
* Returns an action object used to signal a failed meta box update.
* @return {Object} Action object.
function metaBoxUpdatesFailure() {
type: 'META_BOX_UPDATES_FAILURE'
* Action that changes the width of the editing canvas.
* @param {string} deviceType
const __experimentalSetPreviewDeviceType = deviceType => ({
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", {
hint: 'registry.dispatch( editorStore ).setDeviceType'
registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType);
* Returns an action object used to open/close the inserter.
* @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).
const setIsInserterOpened = value => ({
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsInserterOpened", {
alternative: "dispatch( 'core/editor').setIsInserterOpened"
registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value);
* Returns an action object used to open/close the list view.
* @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
const setIsListViewOpened = isOpen => ({
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsListViewOpened", {
alternative: "dispatch( 'core/editor').setIsListViewOpened"
registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen);
* Returns an action object used to switch to template editing.
function setIsEditingTemplate() {
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsEditingTemplate", {
alternative: "dispatch( 'core/editor').setRenderingMode"
* Create a block based template.
function __unstableCreateTemplate() {
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__unstableCreateTemplate", {
let actions_metaBoxesInitialized = false;
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
const initializeMetaBoxes = () => ({
const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady();
if (actions_metaBoxesInitialized) {
const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType();
if (window.postboxes.page !== postType) {
window.postboxes.add_postbox_toggles(postType);
actions_metaBoxesInitialized = true;
// Save metaboxes on save completion, except for autosaves.
(0,external_wp_hooks_namespaceObject.addFilter)('editor.__unstableSavePost', 'core/edit-post/save-metaboxes', (previous, options) => previous.then(() => {
if (options.isAutosave) {
if (!select.hasMetaBoxes()) {
return dispatch.requestMetaBoxUpdates();
type: 'META_BOXES_INITIALIZED'
* Action that toggles Distraction free mode.
* Distraction free mode expects there are no sidebars, as due to the
* z-index values set, you can't close sidebars.
const toggleDistractionFree = () => ({
external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleDistractionFree", {
alternative: "dispatch( 'core/editor').toggleDistractionFree"
registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree();
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
interfaceStore: selectors_interfaceStore
} = unlock(external_wp_editor_namespaceObject.privateApis);
* Returns the current editing mode.
* @param {Object} state Global application state.
* @return {string} Editing mode.
const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
* Returns true if the editor sidebar is opened.
* @param {Object} state Global application state
* @return {boolean} Whether the editor sidebar is opened.
const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core');
return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
* Returns true if the plugin sidebar is opened.
* @param {Object} state Global application state.
* @return {boolean} Whether the plugin sidebar is opened.
const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core');
return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
* Returns the current active general sidebar name, or null if there is no
* general sidebar active. The active general sidebar is a unique name to
* identify either an editor or plugin sidebar.
* - `my-plugin/insert-image-sidebar`
* @param {Object} state Global application state.
* @return {?string} Active general sidebar name.
const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
return select(selectors_interfaceStore).getActiveComplementaryArea('core');
* Converts panels from the new preferences store format to the old format
* that the post editor previously used.
* The resultant converted data should look like this:
* @param {string[] | undefined} inactivePanels An array of inactive panel names.
* @param {string[] | undefined} openPanels An array of open panel names.
* @return {Object} The converted panel data.
function convertPanelsToOldFormat(inactivePanels, openPanels) {
// First reduce the inactive panels.
const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({
// Then reduce the open panels, passing in the result of the previous
// reduction as the initial value so that both open and inactive
// panel state is combined.
const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
const currentPanelState = accumulatedPanels?.[panelName];
}, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {});
// The panels variable will only be set if openPanels wasn't `undefined`.
// If it isn't set just return `panelsWithEnabledState`, and if that isn't
// set return an empty object.
return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT;
* Returns the preferences (these preferences are persisted locally).
* @param {Object} state Global application state.
* @return {Object} Preferences Object.
const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, {
alternative: `select( 'core/preferences' ).get`
const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => {
const value = select(external_wp_preferences_namespaceObject.store).get('core', preferenceKey);
// Panels were a preference, but the data structure changed when the state
// was migrated to the preferences store. They need to be converted from
// the new preferences store format to old format to ensure no breaking
const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels');
const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels');
const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
* @param {Object} state Global application state.
* @param {string} preferenceKey Preference Key.
* @param {*} defaultValue Default Value.
* @return {*} Preference Value.
function getPreference(state, preferenceKey, defaultValue) {
external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, {
alternative: `select( 'core/preferences' ).get`
// Avoid using the `getPreferences` registry selector where possible.
const preferences = getPreferences(state);
const value = preferences[preferenceKey];
return value === undefined ? defaultValue : value;
* Returns an array of blocks that are hidden.
* @return {Array} A list of the hidden block types
const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
* Returns true if the publish sidebar is opened.
* @param {Object} state Global application state
* @return {boolean} Whether the publish sidebar is open.
const isPublishSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
external_wp_deprecated_default()(`select( 'core/edit-post' ).isPublishSidebarOpened`, {
alternative: `select( 'core/editor' ).isPublishSidebarOpened`