Edit Site Edit

Namespace: core/edit-site.

Selectors

Top ↑

getCanUserCreateMedia

Returns whether the current user can create media or not.

Parameters

  • state Object: Global application state.

Returns

  • Object: Whether the current user can create media or not.

Top ↑

getCurrentTemplateNavigationPanelSubMenu

Deprecated

Top ↑

getCurrentTemplateTemplateParts

Returns the template parts and their blocks for the current edited template.

Parameters

  • state Object: Global application state.

Returns

  • Array: Template parts and their blocks in an array.

Top ↑

getEditedPostContext

Deprecated

Returns the edited post’s context object.

Parameters

  • state Object: Global application state.

Returns

  • Object: Page.

Top ↑

getEditedPostId

Returns the ID of the currently edited template or template part.

Parameters

  • state Object: Global application state.

Returns

  • string?: Post ID.

Top ↑

getEditedPostType

Returns the current edited post type (wp_template or wp_template_part).

Parameters

  • state Object: Global application state.

Returns

  • TemplateType?: Template type.

Top ↑

getEditorMode

Returns the current editing mode.

Parameters

  • state Object: Global application state.

Returns

  • string: Editing mode.

Top ↑

getHomeTemplateId

Deprecated

Top ↑

getNavigationPanelActiveMenu

Deprecated

Top ↑

getPage

Deprecated

Returns the current page object.

Parameters

  • state Object: Global application state.

Returns

  • Object: Page.

Top ↑

getReusableBlocks

Returns any available Reusable blocks.

Parameters

  • state Object: Global application state.

Returns

  • Array: The available reusable blocks.

Top ↑

getSettings

Returns the site editor settings.

Parameters

  • state Object: Global application state.

Returns

  • Object: Settings.

Top ↑

hasPageContentFocus

Deprecated

Whether or not the editor allows only page content to be edited.

Returns

  • boolean: Whether or not focus is on editing page content.

Top ↑

isFeatureActive

Deprecated

Returns whether the given feature is enabled or not.

Parameters

  • state Object: Global application state.
  • featureName string: Feature slug.

Returns

  • boolean: Is active.

Top ↑

isInserterOpened

Returns the current opened/closed state of the inserter panel.

Parameters

  • state Object: Global application state.

Returns

  • boolean: True if the inserter panel should be open; false if closed.

Top ↑

isListViewOpened

Returns the current opened/closed state of the list view panel.

Parameters

  • state Object: Global application state.

Returns

  • boolean: True if the list view panel should be open; false if closed.

Top ↑

isNavigationOpened

Deprecated

Top ↑

isPage

Whether or not the editor has a page loaded into it.

Related

  • setPage

Parameters

  • state Object: Global application state.

Returns

  • boolean: Whether or not the editor has a page loaded into it.

Top ↑

isSaveViewOpened

Returns the current opened/closed state of the save panel.

Parameters

  • state Object: Global application state.

Returns

  • boolean: True if the save panel should be open; false if closed.

Top ↑

Actions

Top ↑

addTemplate

Deprecated

Action that adds a new template and sets it as the current template.

Parameters

  • template Object: The template.

Returns

  • Object: Action object used to set the current template.

Top ↑

closeGeneralSidebar

Action that closes the sidebar.

Top ↑

openGeneralSidebar

Action that opens an editor sidebar.

Parameters

  • name ?string: Sidebar name to be opened.

Top ↑

openNavigationPanelToMenu

Deprecated

Opens the navigation panel and sets its active menu at the same time.

Top ↑

removeTemplate

Action that removes a template.

Parameters

  • template Object: The template object.

Top ↑

revertTemplate

Reverts a template to its original theme-provided file.

Parameters

  • template Object: The template to revert.
  • options [Object]:
  • options.allowUndo [boolean]: Whether to allow the user to undo reverting the template. Default true.

Top ↑

setEditedEntity

Action that sets an edited entity.

Parameters

  • postType string: The entity’s post type.
  • postId string: The entity’s ID.
  • context Object: The entity’s context.

Returns

  • Object: Action object.

Top ↑

setEditedPostContext

Set’s the current block editor context.

Parameters

  • context Object: The context object.

Returns

  • Object: Action object.

Top ↑

setHasPageContentFocus

Sets whether or not the editor allows only page content to be edited.

Parameters

  • hasPageContentFocus boolean: True to allow only page content to be edited, false to allow template to be edited.

Top ↑

setHomeTemplateId

Deprecated

Top ↑

setIsInserterOpened

Opens or closes 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.

Returns

  • Object: Action object.

Top ↑

setIsListViewOpened

Sets whether the list view panel should be open.

Parameters

  • isOpen boolean: If true, opens the list view. If false, closes it. It does not toggle the state, but sets it directly.

Top ↑

setIsNavigationPanelOpened

Deprecated

Sets whether the navigation panel should be open.

Top ↑

setIsSaveViewOpened

Sets whether the save view panel should be open.

Parameters

  • isOpen boolean: If true, opens the save view. If false, closes it. It does not toggle the state, but sets it directly.

Top ↑

setNavigationMenu

Action that sets a navigation menu.

Parameters

  • navigationMenuId string: The Navigation Menu Post ID.

Returns

  • Object: Action object.

Top ↑

setNavigationPanelActiveMenu

Deprecated

Action that sets the active navigation panel menu.

Returns

  • Object: Action object.

Top ↑

setPage

Deprecated

Resolves the template for a page and displays both. If no path is given, attempts to use the postId to generate a path like ?p=${ postId }.

Returns

  • number: The resolved template ID for the page route.

Top ↑

setTemplate

Action that sets a template, optionally fetching it from REST API.

Returns

  • Object: Action object.

Top ↑

setTemplatePart

Action that sets a template part.

Parameters

  • templatePartId string: The template part ID.

Returns

  • Object: Action object.

Top ↑

switchEditorMode

Undocumented declaration.

Top ↑

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.

Top ↑

toggleFeature

Dispatches an action that toggles a feature flag.

Parameters

  • featureName string: Feature name.

Top ↑

updateSettings

Returns an action object used to update the settings.

Parameters

  • settings Object: New settings.

Returns

  • Object: Action object.