diff --git a/editor/actions.js b/editor/actions.js
index 445a91787839a..5a168aecf19fa 100644
--- a/editor/actions.js
+++ b/editor/actions.js
@@ -263,6 +263,30 @@ export function stopTyping() {
};
}
+/**
+ * Returns an action object used in signalling that the user toggled the sidebar
+ *
+ * @return {Object} Action object
+ */
+export function toggleSidebar() {
+ return {
+ type: 'TOGGLE_SIDEBAR',
+ };
+}
+
+/**
+ * Returns an action object used in signalling that the user switched the active sidebar tab panel
+ *
+ * @param {String} panel The panel name
+ * @return {Object} Action object
+ */
+export function setActivePanel( panel ) {
+ return {
+ type: 'SET_ACTIVE_PANEL',
+ panel,
+ };
+}
+
/**
* Returns an action object used in signalling that the user toggled a sidebar panel
*
diff --git a/editor/block-settings-menu/content.js b/editor/block-settings-menu/content.js
index 27ed09e50bf11..3b2b0dfac5d6a 100644
--- a/editor/block-settings-menu/content.js
+++ b/editor/block-settings-menu/content.js
@@ -13,14 +13,14 @@ import { IconButton } from '@wordpress/components';
* Internal dependencies
*/
import { isEditorSidebarOpened } from '../selectors';
-import { selectBlock } from '../actions';
+import { selectBlock, removeBlock, toggleSidebar, setActivePanel } from '../actions';
-function BlockSettingsMenuContent( { onDelete, onSelect, isSidebarOpened, toggleSidebar, setActivePanel } ) {
+function BlockSettingsMenuContent( { onDelete, onSelect, isSidebarOpened, onToggleSidebar, onShowInspector } ) {
const toggleInspector = () => {
onSelect();
- setActivePanel();
+ onShowInspector();
if ( ! isSidebarOpened ) {
- toggleSidebar();
+ onToggleSidebar();
}
};
@@ -48,22 +48,16 @@ export default connect(
} ),
( dispatch, ownProps ) => ( {
onDelete() {
- dispatch( {
- type: 'REMOVE_BLOCKS',
- uids: [ ownProps.uid ],
- } );
+ dispatch( removeBlock( ownProps.uid ) );
},
onSelect() {
dispatch( selectBlock( ownProps.uid ) );
},
- setActivePanel() {
- dispatch( {
- type: 'SET_ACTIVE_PANEL',
- panel: 'block',
- } );
+ onShowInspector() {
+ dispatch( setActivePanel( 'block' ) );
},
- toggleSidebar() {
- dispatch( { type: 'TOGGLE_SIDEBAR' } );
+ onToggleSidebar() {
+ dispatch( toggleSidebar() );
},
} )
)( BlockSettingsMenuContent );
diff --git a/editor/header/index.js b/editor/header/index.js
index aa0f6a0e0f8b7..0d48769319655 100644
--- a/editor/header/index.js
+++ b/editor/header/index.js
@@ -19,7 +19,7 @@ import PreviewButton from './preview-button';
import ModeSwitcher from './mode-switcher';
import Inserter from '../inserter';
import { getMultiSelectedBlockUids, hasEditorUndo, hasEditorRedo, isEditorSidebarOpened } from '../selectors';
-import { clearSelectedBlock } from '../actions';
+import { clearSelectedBlock, toggleSidebar, removeBlocks } from '../actions';
function Header( {
multiSelectedBlockUids,
@@ -29,7 +29,7 @@ function Header( {
redo,
hasRedo,
hasUndo,
- toggleSidebar,
+ onToggleSidebar,
isSidebarOpened,
} ) {
const count = multiSelectedBlockUids.length;
@@ -90,7 +90,7 @@ function Header( {