From 250f85586949b76ee3aa078b47b16cdd470687c1 Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Tue, 31 Jan 2023 15:31:27 +0200 Subject: [PATCH] Refactores __ExperimentalOffCanvasEditor to OffCanvasEditor (#47553) * refactores __ExperimentalOffCanvasEditor to OffCanvasEditor * Update packages/block-editor/src/components/off-canvas-editor/README.md * rename the component itself --------- Co-authored-by: Ben Dwyer Co-authored-by: scruffian --- .../block-editor/src/components/off-canvas-editor/README.md | 4 ++-- .../block-editor/src/components/off-canvas-editor/index.js | 4 ++-- packages/block-editor/src/experiments.js | 4 ++-- .../src/navigation/edit/menu-inspector-controls.js | 4 +--- .../src/components/navigation-inspector/navigation-menu.js | 4 +--- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/README.md b/packages/block-editor/src/components/off-canvas-editor/README.md index 0c5f2a36156a5..c2f5293edf422 100644 --- a/packages/block-editor/src/components/off-canvas-editor/README.md +++ b/packages/block-editor/src/components/off-canvas-editor/README.md @@ -1,5 +1,5 @@ -# Experimental Off Canvas Editor +# Off Canvas Editor -The __ExperimentalOffCanvasEditor component is a modified ListView compoent. It provides an overview of the hierarchical structure of all blocks in the editor. The blocks are presented vertically one below the other. It enables editing of hierarchy and addition of elements in the block tree without selecting the block instance on the canvas. +The OffCanvasEditor component is a modified ListView compoent. It provides an overview of the hierarchical structure of all blocks in the editor. The blocks are presented vertically one below the other. It enables editing of hierarchy and addition of elements in the block tree without selecting the block instance on the canvas. It is an experimental component which may end up completely merged into the ListView component via configuration props. diff --git a/packages/block-editor/src/components/off-canvas-editor/index.js b/packages/block-editor/src/components/off-canvas-editor/index.js index bb243e60e638f..6f1c532269697 100644 --- a/packages/block-editor/src/components/off-canvas-editor/index.js +++ b/packages/block-editor/src/components/off-canvas-editor/index.js @@ -63,7 +63,7 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36; * @param {Object} props.LeafMoreMenu Optional more menu substitution. * @param {Object} ref Forwarded ref */ -function __ExperimentalOffCanvasEditor( +function OffCanvasEditor( { id, blocks, @@ -252,4 +252,4 @@ function __ExperimentalOffCanvasEditor( ); } -export default forwardRef( __ExperimentalOffCanvasEditor ); +export default forwardRef( OffCanvasEditor ); diff --git a/packages/block-editor/src/experiments.js b/packages/block-editor/src/experiments.js index 70fce9be81781..d954fc7515530 100644 --- a/packages/block-editor/src/experiments.js +++ b/packages/block-editor/src/experiments.js @@ -8,7 +8,7 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/exp */ import * as globalStyles from './components/global-styles'; import { ExperimentalBlockEditorProvider } from './components/provider'; -import { default as __experimentalOffCanvasEditor } from './components/off-canvas-editor'; +import OffCanvasEditor from './components/off-canvas-editor'; export const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules( @@ -23,5 +23,5 @@ export const experiments = {}; lock( experiments, { ...globalStyles, ExperimentalBlockEditorProvider, - __experimentalOffCanvasEditor, + OffCanvasEditor, } ); diff --git a/packages/block-library/src/navigation/edit/menu-inspector-controls.js b/packages/block-library/src/navigation/edit/menu-inspector-controls.js index e83656af70f96..e2cde0f0f870d 100644 --- a/packages/block-library/src/navigation/edit/menu-inspector-controls.js +++ b/packages/block-library/src/navigation/edit/menu-inspector-controls.js @@ -32,9 +32,7 @@ const ExperimentMainContent = ( { isLoading, isNavigationMenuMissing, } ) => { - const { __experimentalOffCanvasEditor: OffCanvasEditor } = unlock( - blockEditorExperiments - ); + const { OffCanvasEditor } = unlock( blockEditorExperiments ); // Provide a hierarchy of clientIds for the given Navigation block (clientId). // This is required else the list view will display the entire block tree. const clientIdsTree = useSelect( diff --git a/packages/edit-site/src/components/navigation-inspector/navigation-menu.js b/packages/edit-site/src/components/navigation-inspector/navigation-menu.js index 4e7ccbfc3e379..bb463de56dc7c 100644 --- a/packages/edit-site/src/components/navigation-inspector/navigation-menu.js +++ b/packages/edit-site/src/components/navigation-inspector/navigation-menu.js @@ -39,9 +39,7 @@ const ALLOWED_BLOCKS = { export default function NavigationMenu( { innerBlocks } ) { const { updateBlockListSettings } = useDispatch( blockEditorStore ); - const { __experimentalOffCanvasEditor: OffCanvasEditor } = unlock( - blockEditorExperiments - ); + const { OffCanvasEditor } = unlock( blockEditorExperiments ); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList //Think through a better way of doing this, possible with adding allowed blocks to block library metadata