In WordPress 6.5, the site editor has been refactored to match the post editor UI User interface and behavior closely.
Preferences
The preferences have been unified between the post and site editor. For instance, if a user enables the top toolbar in the post editor, it will be honored in the site editor and vice versa.
This means that the following preferences have been moved from the core/edit-post
or core/edit-site
scopes into the core
scope.
- allowRightClickOverrides
- distractionFree
- editorMode
- fixedToolbar
- focusMode
- hiddenBlockTypes
- inactivePanels
- keepCaretInsideBlock
- mostUsedBlocks
- openPanels
- showBlockBreadcrumbs
- showIconLabels
- showListViewByDefault
Accessing the preferences using the previous scope will continue to work but it’s deprecated, you can now access and modify these preferences using:
const isFixedToolbar = window.wp.data.select( 'core/preferences' ).get( 'core', 'fixedToolbar' );
window.wp.data.dispatch( 'core/preferences' ).get( 'core', 'fixedToolbar', true );
Actions and selectors
For the same reasons, the following selectors and actions from ‘edit-post’ store to the ‘editor’ store:
- setIsInserterOpened
- setIsListViewOpened
- isInserterOpened
- isListViewOpened
- isEditorPanelEnabled
- isEditorPanelOpened
- isEditorPanelRemoved
- removeEditorPanel
- toggleEditorPanelEnabled
- toggleEditorPanelOpened
const isInserterOpened = window.wp.data.select( 'core/editor' ).isInserterOpened();
Editor Store
The site editor now relies on the editor package, thie means that in order to retrieve the currently edited post or entity, you can use the editor store selectors:
const editedPostType = wp.data.select( 'core/editor' ).getCurrentPostType();
const editedPostId = wp.data.select( 'core/editor' ).getCurrentPostId();
The rest of the editor store selectors and actions should also be now usable within the site editor.
Props to @audrasjb for the technical review and @leonnugraha for the copy review
#6-5, #dev-notes, #dev-notes-6-5