From e913938ac338cd2a3ee8875703c1a4e792d9f002 Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Thu, 5 Jan 2023 13:39:32 +0000 Subject: [PATCH] determine inspector tabs via state --- .../data/data-core-block-editor.md | 8 ++++++++ .../src/components/block-card/index.js | 8 ++++++-- .../inspector-controls-tabs/index.js | 19 +++++++++---------- .../use-inspector-controls-tabs.js | 4 +--- .../off-canvas-editor/block-edit-button.js | 4 +++- packages/block-editor/src/store/actions.js | 6 ++++++ packages/block-editor/src/store/reducer.js | 10 ++++++++++ packages/block-editor/src/store/selectors.js | 4 ++++ 8 files changed, 47 insertions(+), 16 deletions(-) diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md index 1b9da160f0f6fb..bf601ea6a2139a 100644 --- a/docs/reference-guides/data/data-core-block-editor.md +++ b/docs/reference-guides/data/data-core-block-editor.md @@ -477,6 +477,10 @@ _Returns_ - `Array`: ids of top-level and descendant blocks. +### getDefaultInspectorControlsTab + +Undocumented declaration. + ### getDraggedBlockClientIds Returns the client ids of any blocks being directly dragged. @@ -1485,6 +1489,10 @@ _Parameters_ - _updates_ `Record`: For each block's clientId, its new visibility setting. +### setDefaultInspectorControlsTab + +Undocumented declaration. + ### setHasControlledInnerBlocks Action that sets whether a block has controlled inner blocks. diff --git a/packages/block-editor/src/components/block-card/index.js b/packages/block-editor/src/components/block-card/index.js index dab832861ae661..cadfe4ef613793 100644 --- a/packages/block-editor/src/components/block-card/index.js +++ b/packages/block-editor/src/components/block-card/index.js @@ -45,13 +45,17 @@ function BlockCard( { title, icon, description, blockType, className } ) { }; }, [] ); - const { selectBlock } = useDispatch( blockEditorStore ); + const { selectBlock, setDefaultInspectorControlsTab } = + useDispatch( blockEditorStore ); return (
{ isOffCanvasNavigationEditorEnabled && parentNavBlockClientId && (