Skip to content

Commit

Permalink
Escape out of block moving mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Jun 4, 2020
1 parent ced78ca commit a04a737
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/block-editor/src/components/block-list/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ function BlockBreadcrumb( {
const { name, attributes } = __unstableGetBlockWithoutInnerBlocks(
clientId
);
return { index, name, attributes, isBlockMovingMode };
const blockMovingMode = isBlockMovingMode();
return { index, name, attributes, blockMovingMode };
},
[ clientId, rootClientId ]
);
const { index, name, attributes, isBlockMovingMode } = selected;
const { index, name, attributes, blockMovingMode } = selected;
const { setNavigationMode, removeBlock } = useDispatch(
'core/block-editor'
);
Expand Down Expand Up @@ -80,7 +81,7 @@ function BlockBreadcrumb( {
);

const classNames = classnames( 'block-editor-block-list__breadcrumb', {
'is-navigate-mode': !! isBlockMovingMode(),
'is-block-moving-mode': !! blockMovingMode,
} );

return (
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,12 @@
}


.is-navigate-mode.block-editor-block-list__breadcrumb {
.is-block-moving-mode.block-editor-block-list__breadcrumb {
// Should be invisible but not unfocusable.
opacity: 0;
font-size: 1px;
height: 1px;
padding: 0;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/writing-flow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,10 @@ export default function WritingFlow( { children } ) {
)
);
}

if ( isEscape && startingBlockClientId ) {
setBlockMovingMode( null );
setCanInsertMovingBlock( false );
}
if ( ( isEnter || isSpace ) && startingBlockClientId ) {
const sourceRoot = getBlockRootClientId(
startingBlockClientId
Expand Down

0 comments on commit a04a737

Please sign in to comment.