Skip to content

Commit

Permalink
Refactores __ExperimentalOffCanvasEditor to OffCanvasEditor (#47553)
Browse files Browse the repository at this point in the history
* refactores __ExperimentalOffCanvasEditor to OffCanvasEditor

* Update packages/block-editor/src/components/off-canvas-editor/README.md

* rename the component itself

---------

Co-authored-by: Ben Dwyer <[email protected]>
Co-authored-by: scruffian <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2023
1 parent e6ccc25 commit 250f855
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -252,4 +252,4 @@ function __ExperimentalOffCanvasEditor(
);
}

export default forwardRef( __ExperimentalOffCanvasEditor );
export default forwardRef( OffCanvasEditor );
4 changes: 2 additions & 2 deletions packages/block-editor/src/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -23,5 +23,5 @@ export const experiments = {};
lock( experiments, {
...globalStyles,
ExperimentalBlockEditorProvider,
__experimentalOffCanvasEditor,
OffCanvasEditor,
} );
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 250f855

Please sign in to comment.