The Post Editor’s Data

In this article

Namespace: core/editor.

Selectors

canInsertBlockType

Related

  • canInsertBlockType in core/block-editor store.

canUserUseUnfilteredHTML

Returns whether or not the user has the unfiltered_html capability.

Parameters

  • state Object: Editor state.

Returns

  • boolean: Whether the user can or can’t post unfiltered HTML.

didPostSaveRequestFail

Returns true if a previous post save was attempted but failed, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post save failed.

didPostSaveRequestSucceed

Returns true if a previous post save was attempted successfully, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post was saved successfully.

getActivePostLock

Returns the active post lock.

Parameters

  • state Object: Global application state.

Returns

  • Object: The lock object.

getAdjacentBlockClientId

Related

  • getAdjacentBlockClientId in core/block-editor store.

getAutosaveAttribute

Deprecated since 5.6. Callers should use the getAutosave( postType, postId, userId ) selector from the ‘@wordpress/core-data’ package and access properties on the returned autosave object using getPostRawValue.

Returns an attribute value of the current autosave revision for a post, or null if there is no autosave for the post.

Parameters

  • state Object: Global application state.
  • attributeName string: Autosave attribute name.

Returns

  • *: Autosave attribute value.

getBlock

Related

  • getBlock in core/block-editor store.

getBlockAttributes

Related

  • getBlockAttributes in core/block-editor store.

getBlockCount

Related

  • getBlockCount in core/block-editor store.

getBlockHierarchyRootClientId

Related

  • getBlockHierarchyRootClientId in core/block-editor store.

getBlockIndex

Related

  • getBlockIndex in core/block-editor store.

getBlockInsertionPoint

Related

  • getBlockInsertionPoint in core/block-editor store.

getBlockListSettings

Related

  • getBlockListSettings in core/block-editor store.

getBlockMode

Related

  • getBlockMode in core/block-editor store.

getBlockName

Related

  • getBlockName in core/block-editor store.

getBlockOrder

Related

  • getBlockOrder in core/block-editor store.

getBlockRootClientId

Related

  • getBlockRootClientId in core/block-editor store.

getBlocks

Related

  • getBlocks in core/block-editor store.

getBlocksByClientId

Related

  • getBlocksByClientId in core/block-editor store.

getBlockSelectionEnd

Related

  • getBlockSelectionEnd in core/block-editor store.

getBlockSelectionStart

Related

  • getBlockSelectionStart in core/block-editor store.

getClientIdsOfDescendants

Related

  • getClientIdsOfDescendants in core/block-editor store.

getClientIdsWithDescendants

Related

  • getClientIdsWithDescendants in core/block-editor store.

getCurrentPost

Returns the post currently being edited in its last known saved state, not including unsaved edits. Returns an object containing relevant default post values if the post has not yet been saved.

Parameters

  • state Object: Global application state.

Returns

  • Object: Post object.

getCurrentPostAttribute

Returns an attribute value of the saved post.

Parameters

  • state Object: Global application state.
  • attributeName string: Post attribute name.

Returns

  • *: Post attribute value.

getCurrentPostId

Returns the ID of the post currently being edited, or null if the post has not yet been saved.

Parameters

  • state Object: Global application state.

Returns

  • ?number: ID of current post.

getCurrentPostLastRevisionId

Returns the last revision ID of the post currently being edited, or null if the post has no revisions.

Parameters

  • state Object: Global application state.

Returns

  • ?number: ID of the last revision.

getCurrentPostRevisionsCount

Returns the number of revisions of the post currently being edited.

Parameters

  • state Object: Global application state.

Returns

  • number: Number of revisions.

getCurrentPostType

Returns the post type of the post currently being edited.

Usage

const currentPostType = wp.data.select( 'core/editor' ).getCurrentPostType();

Parameters

  • state Object: Global application state.

Returns

  • string: Post type.

getCurrentTemplateId

Returns the template ID currently being rendered/edited

Parameters

  • state Object: Global application state.

Returns

  • ?string: Template ID.

getDeviceType

Returns the current editing canvas device type.

Parameters

  • state Object: Global application state.

Returns

  • string: Device type.

getEditedPostAttribute

Returns a single attribute of the post being edited, preferring the unsaved edit if one exists, but falling back to the attribute for the last known saved state of the post.

Usage

// Get specific media size based on the featured media ID
// Note: change sizes?.large for any registered size
const getFeaturedMediaUrl = useSelect( ( select ) => {
    const getFeaturedMediaId =
        select( 'core/editor' ).getEditedPostAttribute( 'featured_media' );
    const getMedia = select( 'core' ).getMedia( getFeaturedMediaId );

    return (
        getMedia?.media_details?.sizes?.large?.source_url ||
        getMedia?.source_url ||
        ''
    );
}, [] );

Parameters

  • state Object: Global application state.
  • attributeName string: Post attribute name.

Returns

  • *: Post attribute value.

getEditedPostContent

Returns the content of the post being edited.

Parameters

  • state Object: Global application state.

Returns

  • string: Post content.

Returns the post preview link

Parameters

  • state Object: Global application state.

Returns

  • string | undefined: Preview Link.

getEditedPostSlug

Returns the slug for the post being edited, preferring a manually edited value if one exists, then a sanitized version of the current post title, and finally the post ID.

Parameters

  • state Object: Editor state.

Returns

  • string: The current slug to be displayed in the editor

getEditedPostVisibility

Returns the current visibility of the post being edited, preferring the unsaved value if different than the saved post. The return value is one of “private”, “password”, or “public”.

Parameters

  • state Object: Global application state.

Returns

  • string: Post visibility.

getEditorBlocks

Return the current block list.

Parameters

  • state Object:

Returns

  • Array: Block list.

getEditorMode

Returns the current editing mode.

Parameters

  • state Object: Global application state.

Returns

  • string: Editing mode.

getEditorSelection

Returns the current selection.

Parameters

  • state Object:

Returns

  • WPBlockSelection: The selection end.

getEditorSelectionEnd

Deprecated since Gutenberg 10.0.0.

Returns the current selection end.

Parameters

  • state Object:

Returns

  • WPBlockSelection: The selection end.

getEditorSelectionStart

Deprecated since Gutenberg 10.0.0.

Returns the current selection start.

Parameters

  • state Object:

Returns

  • WPBlockSelection: The selection start.

getEditorSettings

Returns the post editor settings.

Parameters

  • state Object: Editor state.

Returns

  • Object: The editor settings object.

getFirstMultiSelectedBlockClientId

Related

  • getFirstMultiSelectedBlockClientId in core/block-editor store.

getGlobalBlockCount

Related

  • getGlobalBlockCount in core/block-editor store.

getInserterItems

Related

  • getInserterItems in core/block-editor store.

getLastMultiSelectedBlockClientId

Related

  • getLastMultiSelectedBlockClientId in core/block-editor store.

getMultiSelectedBlockClientIds

Related

  • getMultiSelectedBlockClientIds in core/block-editor store.

getMultiSelectedBlocks

Related

  • getMultiSelectedBlocks in core/block-editor store.

getMultiSelectedBlocksEndClientId

Related

  • getMultiSelectedBlocksEndClientId in core/block-editor store.

getMultiSelectedBlocksStartClientId

Related

  • getMultiSelectedBlocksStartClientId in core/block-editor store.

getNextBlockClientId

Related

  • getNextBlockClientId in core/block-editor store.

Returns the permalink for the post.

Parameters

  • state Object: Editor state.

Returns

  • ?string: The permalink, or null if the post is not viewable.

getPermalinkParts

Returns the permalink for a post, split into its three parts: the prefix, the postName, and the suffix.

Parameters

  • state Object: Editor state.

Returns

  • Object: An object containing the prefix, postName, and suffix for the permalink, or null if the post is not viewable.

getPostEdits

Returns any post values which have been changed in the editor but not yet been saved.

Parameters

  • state Object: Global application state.

Returns

  • Object: Object of key value pairs comprising unsaved edits.

getPostLockUser

Returns details about the post lock user.

Parameters

  • state Object: Global application state.

Returns

  • Object: A user object.

getPostTypeLabel

Returns a post type label depending on the current post.

Parameters

  • state Object: Global application state.

Returns

  • string|undefined: The post type label if available, otherwise undefined.

getPreviousBlockClientId

Related

  • getPreviousBlockClientId in core/block-editor store.

getRenderingMode

Returns the post editor’s rendering mode.

Parameters

  • state Object: Editor state.

Returns

  • string: Rendering mode.

getSelectedBlock

Related

  • getSelectedBlock in core/block-editor store.

getSelectedBlockClientId

Related

  • getSelectedBlockClientId in core/block-editor store.

getSelectedBlockCount

Related

  • getSelectedBlockCount in core/block-editor store.

getSelectedBlocksInitialCaretPosition

Related

  • getSelectedBlocksInitialCaretPosition in core/block-editor store.

getStateBeforeOptimisticTransaction

Deprecated since Gutenberg 9.7.0.

Returns state object prior to a specified optimist transaction ID, or null if the transaction corresponding to the given ID cannot be found.

getSuggestedPostFormat

Returns a suggested post format for the current post, inferred only if there is a single block within the post and it is of a type known to match a default post format. Returns null if the format cannot be determined.

Returns

  • ?string: Suggested post format.

getTemplate

Related

  • getTemplate in core/block-editor store.

getTemplateLock

Related

  • getTemplateLock in core/block-editor store.

hasChangedContent

Returns true if content includes unsaved changes, or false otherwise.

Parameters

  • state Object: Editor state.

Returns

  • boolean: Whether content includes unsaved changes.

hasEditorRedo

Returns true if any future editor history snapshots exist, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether redo history exists.

hasEditorUndo

Returns true if any past editor history snapshots exist, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether undo history exists.

hasInserterItems

Related

  • hasInserterItems in core/block-editor store.

hasMultiSelection

Related

  • hasMultiSelection in core/block-editor store.

hasNonPostEntityChanges

Returns true if there are unsaved edits for entities other than the editor’s post, and false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether there are edits or not.

hasSelectedBlock

Related

  • hasSelectedBlock in core/block-editor store.

hasSelectedInnerBlock

Related

  • hasSelectedInnerBlock in core/block-editor store.

inSomeHistory

Deprecated since Gutenberg 9.7.0.

Returns true if an optimistic transaction is pending commit, for which the before state satisfies the given predicate function.

isAncestorMultiSelected

Related

  • isAncestorMultiSelected in core/block-editor store.

isAutosavingPost

Returns true if the post is autosaving, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post is autosaving.

isBlockInsertionPointVisible

Related

  • isBlockInsertionPointVisible in core/block-editor store.

isBlockMultiSelected

Related

  • isBlockMultiSelected in core/block-editor store.

isBlockSelected

Related

  • isBlockSelected in core/block-editor store.

isBlockValid

Related

  • isBlockValid in core/block-editor store.

isBlockWithinSelection

Related

  • isBlockWithinSelection in core/block-editor store.

isCaretWithinFormattedText

Related

  • isCaretWithinFormattedText in core/block-editor store.

isCleanNewPost

Returns true if there are no unsaved values for the current edit session and if the currently edited post is new (has never been saved before).

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether new post and unsaved values exist.

isCurrentPostPending

Returns true if post is pending review.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether current post is pending review.

isCurrentPostPublished

Return true if the current post has already been published.

Parameters

  • state Object: Global application state.
  • currentPost [Object]: Explicit current post for bypassing registry selector.

Returns

  • boolean: Whether the post has been published.

isCurrentPostScheduled

Returns true if post is already scheduled.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether current post is scheduled to be posted.

isDeletingPost

Returns true if the post is currently being deleted, or false otherwise.

Parameters

  • state Object: Editor state.

Returns

  • boolean: Whether post is being deleted.

isEditedPostAutosaveable

Returns true if the post can be autosaved, or false otherwise.

Parameters

  • state Object: Global application state.
  • autosave Object: A raw autosave object from the REST API.

Returns

  • boolean: Whether the post can be autosaved.

isEditedPostBeingScheduled

Return true if the post being edited is being scheduled. Preferring the unsaved status values.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post has been published.

isEditedPostDateFloating

Returns whether the current post should be considered to have a “floating” date (i.e. that it would publish “Immediately” rather than at a set time).

Unlike in the PHP backend, the REST API returns a full date string for posts where the 0000-00-00T00:00:00 placeholder is present in the database. To infer that a post is set to publish “Immediately” we check whether the date and modified date are the same.

Parameters

  • state Object: Editor state.

Returns

  • boolean: Whether the edited post has a floating date value.

isEditedPostDirty

Returns true if there are unsaved values for the current edit session, or false if the editing state matches the saved or new post.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether unsaved values exist.

isEditedPostEmpty

Returns true if the edited post has content. A post has content if it has at least one saveable block or otherwise has a non-empty content property assigned.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether post has content.

isEditedPostNew

Returns true if the currently edited post is yet to be saved, or false if the post has been saved.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post is new.

isEditedPostPublishable

Return true if the post being edited can be published.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post can been published.

isEditedPostSaveable

Returns true if the post can be saved, or false otherwise. A post must contain a title, an excerpt, or non-empty content to be valid for save.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post can be saved.

isEditorPanelEnabled

Returns true if the given panel is enabled, or false otherwise. Panels are enabled by default.

Parameters

  • state Object: Global application state.
  • panelName string: A string that identifies the panel.

Returns

  • boolean: Whether or not the panel is enabled.

isEditorPanelOpened

Returns true if the given panel is open, or false otherwise. Panels are closed by default.

Parameters

  • state Object: Global application state.
  • panelName string: A string that identifies the panel.

Returns

  • boolean: Whether or not the panel is open.

isEditorPanelRemoved

Returns true if the given panel was programmatically removed, or false otherwise. All panels are not removed by default.

Parameters

  • state Object: Global application state.
  • panelName string: A string that identifies the panel.

Returns

  • boolean: Whether or not the panel is removed.

isFirstMultiSelectedBlock

Related

  • isFirstMultiSelectedBlock in core/block-editor store.

isInserterOpened

Returns true if the inserter is opened.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the inserter is opened.

isListViewOpened

Returns true if the list view is opened.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the list view is opened.

isMultiSelecting

Related

  • isMultiSelecting in core/block-editor store.

isPermalinkEditable

Returns whether the permalink is editable or not.

Parameters

  • state Object: Editor state.

Returns

  • boolean: Whether or not the permalink is editable.

isPostAutosavingLocked

Returns whether post autosaving is locked.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Is locked.

isPostLocked

Returns whether the post is locked.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Is locked.

isPostLockTakeover

Returns whether the edition of the post has been taken over.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Is post lock takeover.

isPostSavingLocked

Returns whether post saving is locked.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Is locked.

isPreviewingPost

Returns true if the post is being previewed, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether the post is being previewed.

isPublishingPost

Returns true if the post is being published, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether post is being published.

isPublishSidebarEnabled

Returns whether the pre-publish panel should be shown or skipped when the user clicks the “publish” button.

Returns

  • boolean: Whether the pre-publish panel should be shown or not.

isPublishSidebarOpened

Returns true if the publish sidebar is opened.

Parameters

  • state Object: Global application state

Returns

  • boolean: Whether the publish sidebar is open.

isSavingNonPostEntityChanges

Returns true if non-post entities are currently being saved, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether non-post entities are being saved.

isSavingPost

Returns true if the post is currently being saved, or false otherwise.

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether post is being saved.

isSelectionEnabled

Related

  • isSelectionEnabled in core/block-editor store.

isTyping

Related

  • isTyping in core/block-editor store.

isValidTemplate

Related

  • isValidTemplate in core/block-editor store.

Actions

autosave

Action that autosaves the current post. This includes server-side autosaving (default) and client-side (a.k.a. local) autosaving (e.g. on the Web, the post might be committed to Session Storage).

Parameters

  • options [Object]: Extra flags to identify the autosave.
  • options.local [boolean]: Whether to perform a local autosave.

clearSelectedBlock

Related

  • clearSelectedBlock in core/block-editor store.

closePublishSidebar

Returns an action object used in signalling that the user closed the publish sidebar.

Returns

  • Object: Action object.

createUndoLevel

Deprecated Since WordPress 6.0

Action that creates an undo history record.

disablePublishSidebar

Disables the publish sidebar.

editPost

Returns an action object used in signalling that attributes of the post have been edited.

Usage

// Update the post title
wp.data.dispatch( 'core/editor' ).editPost( { title: `${ newTitle }` } );
// Get specific media size based on the featured media ID
// Note: change sizes?.large for any registered size
const getFeaturedMediaUrl = useSelect( ( select ) => {
    const getFeaturedMediaId =
        select( 'core/editor' ).getEditedPostAttribute( 'featured_media' );
    const getMedia = select( 'core' ).getMedia( getFeaturedMediaId );

    return (
        getMedia?.media_details?.sizes?.large?.source_url ||
        getMedia?.source_url ||
        ''
    );
}, [] );

Parameters

  • edits Object: Post attributes to edit.
  • options [Object]: Options for the edit.

Returns

  • Object: Action object

enablePublishSidebar

Enable the publish sidebar.

enterFormattedText

Related

  • enterFormattedText in core/block-editor store.

exitFormattedText

Related

  • exitFormattedText in core/block-editor store.

hideInsertionPoint

Related

  • hideInsertionPoint in core/block-editor store.

insertBlock

Related

  • insertBlock in core/block-editor store.

insertBlocks

Related

  • insertBlocks in core/block-editor store.

insertDefaultBlock

Related

  • insertDefaultBlock in core/block-editor store.

lockPostAutosaving

Action that locks post autosaving.

Usage

// Lock post autosaving with the lock key `mylock`:
wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );

Parameters

  • lockName string: The lock name.

Returns

  • Object: Action object

lockPostSaving

Action that locks post saving.

Usage

const { subscribe } = wp.data;

const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );

// Only allow publishing posts that are set to a future date.
if ( 'publish' !== initialPostStatus ) {

    // Track locking.
    let locked = false;

    // Watch for the publish event.
    let unssubscribe = subscribe( () => {
        const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
        if ( 'publish' !== currentPostStatus ) {

            // Compare the post date to the current date, lock the post if the date isn't in the future.
            const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
            const currentDate = new Date();
            if ( postDate.getTime() <= currentDate.getTime() ) {
                if ( ! locked ) {
                    locked = true;
                    wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
                }
            } else {
                if ( locked ) {
                    locked = false;
                    wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
                }
            }
        }
    } );
}

Parameters

  • lockName string: The lock name.

Returns

  • Object: Action object

mergeBlocks

Related

  • mergeBlocks in core/block-editor store.

moveBlocksDown

Related

  • moveBlocksDown in core/block-editor store.

moveBlocksUp

Related

  • moveBlocksUp in core/block-editor store.

moveBlockToPosition

Related

  • moveBlockToPosition in core/block-editor store.

multiSelect

Related

  • multiSelect in core/block-editor store.

openPublishSidebar

Returns an action object used in signalling that the user opened the publish sidebar.

Returns

  • Object: Action object

receiveBlocks

Related

  • receiveBlocks in core/block-editor store.

redo

Action that restores last popped state in undo history.

refreshPost

Deprecated Since WordPress 6.0.

Action for refreshing the current post.

removeBlock

Related

  • removeBlock in core/block-editor store.

removeBlocks

Related

  • removeBlocks in core/block-editor store.

removeEditorPanel

Returns an action object used to remove a panel from the editor.

Parameters

  • panelName string: A string that identifies the panel to remove.

Returns

  • Object: Action object.

replaceBlock

Related

  • replaceBlock in core/block-editor store.

replaceBlocks

Related

  • replaceBlocks in core/block-editor store.

resetBlocks

Related

  • resetBlocks in core/block-editor store.

resetEditorBlocks

Returns an action object used to signal that the blocks have been updated.

Parameters

  • blocks Array: Block Array.
  • options [Object]: Optional options.

resetPost

Deprecated Since WordPress 6.0.

Returns an action object used in signalling that the latest version of the post has been received, either by initialization or save.

savePost

Action for saving the current post in the editor.

Parameters

  • options [Object]:

selectBlock

Related

  • selectBlock in core/block-editor store.

setDeviceType

Action that changes the width of the editing canvas.

Parameters

  • deviceType string:

Returns

  • Object: Action object.

setEditedPost

Returns an action that sets the current post Type and post ID.

Parameters

  • postType string: Post Type.
  • postId string: Post ID.

Returns

  • Object: Action object.

setIsInserterOpened

Returns an action object used to open/close the inserter.

Parameters

  • value boolean|Object: Whether the inserter should be opened (true) or closed (false). To specify an insertion point, use an object.
  • value.rootClientId string: The root client ID to insert at.
  • value.insertionIndex number: The index to insert at.
  • value.filterValue string: A query to filter the inserter results.
  • value.onSelect Function: A callback when an item is selected.
  • value.tab string: The tab to open in the inserter.
  • value.category string: The category to initialize in the inserter.

Returns

  • Object: Action object.

setIsListViewOpened

Returns an action object used to open/close the list view.

Parameters

  • isOpen boolean: A boolean representing whether the list view should be opened or closed.

Returns

  • Object: Action object.

setRenderingMode

Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes:

  • post-only: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template.
  • template-locked: This mode renders both the template and the post blocks but the template blocks are locked and can’t be edited. The post blocks are editable.

Parameters

  • mode string: Mode (one of ‘post-only’ or ‘template-locked’).

setTemplateValidity

Related

  • setTemplateValidity in core/block-editor store.

setupEditor

Returns an action generator used in signalling that editor has initialized with the specified post object and editor settings.

Parameters

  • post Object: Post object.
  • edits Object: Initial edited attributes object.
  • template [Array]: Block Template.

setupEditorState

Deprecated

Setup the editor state.

Parameters

  • post Object: Post object.

showInsertionPoint

Related

  • showInsertionPoint in core/block-editor store.

startMultiSelect

Related

  • startMultiSelect in core/block-editor store.

startTyping

Related

  • startTyping in core/block-editor store.

stopMultiSelect

Related

  • stopMultiSelect in core/block-editor store.

stopTyping

Related

  • stopTyping in core/block-editor store.

switchEditorMode

Triggers an action used to switch editor mode.

Parameters

  • mode string: The editor mode.

synchronizeTemplate

Related

  • synchronizeTemplate in core/block-editor store.

toggleBlockMode

Related

  • toggleBlockMode in core/block-editor store.

toggleDistractionFree

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.

Parameters

  • options [Object]: Optional configuration object
  • options.createNotice [boolean]: Whether to create a notice

toggleEditorPanelEnabled

Returns an action object used to enable or disable a panel in the editor.

Parameters

  • panelName string: A string that identifies the panel to enable or disable.

Returns

  • Object: Action object.

toggleEditorPanelOpened

Opens a closed panel and closes an open panel.

Parameters

  • panelName string: A string that identifies the panel to open or close.

togglePublishSidebar

Returns an action object used in signalling that the user toggles the publish sidebar.

Returns

  • Object: Action object

toggleSelection

Related

  • toggleSelection in core/block-editor store.

toggleSpotlightMode

Action that toggles the Spotlight Mode view option.

toggleTopToolbar

Action that toggles the Top Toolbar view option.

trashPost

Action for trashing the current post in the editor.

undo

Action that pops a record from undo history and undoes the edit.

unlockPostAutosaving

Action that unlocks post autosaving.

Usage

// Unlock post saving with the lock key `mylock`:
wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );

Parameters

  • lockName string: The lock name.

Returns

  • Object: Action object

unlockPostSaving

Action that unlocks post saving.

Usage

// Unlock post saving with the lock key `mylock`:
wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );

Parameters

  • lockName string: The lock name.

Returns

  • Object: Action object

updateBlock

Related

  • updateBlock in core/block-editor store.

updateBlockAttributes

Related

  • updateBlockAttributes in core/block-editor store.

updateBlockListSettings

Related

  • updateBlockListSettings in core/block-editor store.

updateEditorSettings

Undocumented declaration.

updatePost

Deprecated since Gutenberg 9.7.0.

Returns an action object used in signalling that a patch of updates for the latest version of the post have been received.

Returns

  • Object: Action object.

updatePostLock

Action that locks the editor.

Parameters

  • lock Object: Details about the post lock status, user, and nonce.

Returns

  • Object: Action object.