+
{ rootClientId && (
@@ -68,11 +75,12 @@ export class BlockBreadcrumb extends Component {
export default compose( [
withSelect( ( select, ownProps ) => {
- const { getBlockRootClientId } = select( 'core/editor' );
+ const { getBlockRootClientId, getEditorSettings } = select( 'core/editor' );
const { clientId } = ownProps;
return {
rootClientId: getBlockRootClientId( clientId ),
+ isLight: getEditorSettings().hasFixedToolbar,
};
} ),
] )( BlockBreadcrumb );
diff --git a/packages/editor/src/components/block-list/style.scss b/packages/editor/src/components/block-list/style.scss
index c7b82bd04c1e80..f082c5d255c697 100644
--- a/packages/editor/src/components/block-list/style.scss
+++ b/packages/editor/src/components/block-list/style.scss
@@ -101,6 +101,16 @@
.editor-block-list__block-edit .reusable-block-edit-panel * {
z-index: z-index(".editor-block-list__block-edit .reusable-block-edit-panel *");
}
+
+ &.is-focus-mode:not(.is-multi-selected) {
+ opacity: 0.5;
+ transition: opacity 0.1s linear;
+
+ &:not(.is-focused) .editor-block-list__block,
+ &.is-focused {
+ opacity: 1;
+ }
+ }
}
@@ -852,7 +862,6 @@
.components-toolbar {
border-top: none;
border-bottom: none;
-
}
@include break-small() {
@@ -897,6 +906,10 @@
}
}
+.editor-block-list__block.is-focus-mode:not(.is-multi-selected) > .editor-block-contextual-toolbar {
+ margin-left: -$block-side-ui-width;
+}
+
// Enable toolbar footprint collapsing
.editor-block-contextual-toolbar {
// Position the contextual toolbar above the block.
@@ -1008,6 +1021,11 @@
@include fade_in(60ms, 0.5s);
}
}
+
+ &.is-light .components-toolbar {
+ background: rgba($white, 0.5);
+ color: $dark-gray-700;
+ }
}
.editor-block-list__descendant-arrow::before {
diff --git a/packages/editor/src/components/post-permalink/style.scss b/packages/editor/src/components/post-permalink/style.scss
index dfe7b7270f9db9..bb94a759def88c 100644
--- a/packages/editor/src/components/post-permalink/style.scss
+++ b/packages/editor/src/components/post-permalink/style.scss
@@ -10,7 +10,6 @@
// Use opacity to work in various editor styles.
border: $border-width solid $dark-opacity-light-500;
- border-bottom: none;
background-clip: padding-box;
// Put toolbar snugly to edge on mobile.
diff --git a/packages/editor/src/components/post-title/index.js b/packages/editor/src/components/post-title/index.js
index af836f6c89de3c..8393c2d4d67aee 100644
--- a/packages/editor/src/components/post-title/index.js
+++ b/packages/editor/src/components/post-title/index.js
@@ -88,9 +88,13 @@ class PostTitle extends Component {
}
render() {
- const { title, placeholder, instanceId, isPostTypeViewable } = this.props;
+ const { title, placeholder, instanceId, isPostTypeViewable, isFocusMode, hasFixedToolbar } = this.props;
const { isSelected } = this.state;
- const className = classnames( 'editor-post-title__block', { 'is-selected': isSelected } );
+ const className = classnames( 'editor-post-title__block', {
+ 'is-selected': isSelected,
+ 'is-focus-mode': isFocusMode,
+ 'has-fixed-toolbar': hasFixedToolbar,
+ } );
const decodedPlaceholder = decodeEntities( placeholder );
return (
@@ -129,12 +133,14 @@ const applyWithSelect = withSelect( ( select ) => {
const { getEditedPostAttribute, getEditorSettings } = select( 'core/editor' );
const { getPostType } = select( 'core' );
const postType = getPostType( getEditedPostAttribute( 'type' ) );
- const { titlePlaceholder } = getEditorSettings();
+ const { titlePlaceholder, focusMode, hasFixedToolbar } = getEditorSettings();
return {
title: getEditedPostAttribute( 'title' ),
isPostTypeViewable: get( postType, [ 'viewable' ], false ),
placeholder: titlePlaceholder,
+ isFocusMode: focusMode,
+ hasFixedToolbar,
};
} );
diff --git a/packages/editor/src/components/post-title/style.scss b/packages/editor/src/components/post-title/style.scss
index 35536b6b41fa07..eebb13bf32868d 100644
--- a/packages/editor/src/components/post-title/style.scss
+++ b/packages/editor/src/components/post-title/style.scss
@@ -37,17 +37,28 @@
font-weight: 600;
}
- &.is-selected .editor-post-title__input {
- // use opacity to work in various editor styles
- border-color: $dark-opacity-light-500;
+ &:not(.is-focus-mode):not(.has-fixed-toolbar) {
+ &.is-selected .editor-post-title__input {
+ // use opacity to work in various editor styles
+ border-color: $dark-opacity-light-500;
- .is-dark-theme & {
- border-color: $light-opacity-light-500;
+ .is-dark-theme & {
+ border-color: $light-opacity-light-500;
+ }
+ }
+
+ .editor-post-title__input:hover {
+ border-color: theme(outlines);
}
}
- .editor-post-title__input:hover {
- border-color: theme(outlines);
+ &.is-focus-mode .editor-post-title__input {
+ opacity: 0.5;
+ transition: opacity 0.1s linear;
+
+ &:focus {
+ opacity: 1;
+ }
}
}
@@ -55,7 +66,7 @@
font-size: $default-font-size;
color: $dark-gray-900;
position: absolute;
- top: -$block-toolbar-height + $border-width + $border-width; // Shift this element upward the same height as the block toolbar, minus the border size
+ top: -$block-toolbar-height + $border-width + $border-width + 1px; // Shift this element upward the same height as the block toolbar, minus the border size
left: 0;
right: 0;
diff --git a/packages/editor/src/store/defaults.js b/packages/editor/src/store/defaults.js
index 56a7db862be1c5..bc4be6692059b6 100644
--- a/packages/editor/src/store/defaults.js
+++ b/packages/editor/src/store/defaults.js
@@ -16,6 +16,7 @@ export const PREFERENCES_DEFAULTS = {
* maxWidth number Max width to constraint resizing
* blockTypes boolean|Array Allowed block types
* hasFixedToolbar boolean Whether or not the editor toolbar is fixed
+ * focusMode boolean Whether the focus mode is enabled or not
*/
export const EDITOR_SETTINGS_DEFAULTS = {
alignWide: false,
diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js
index a1edb8e88149a1..efe607f96075ce 100644
--- a/packages/editor/src/store/selectors.js
+++ b/packages/editor/src/store/selectors.js
@@ -1101,15 +1101,19 @@ export function isBlockSelected( state, clientId ) {
/**
* Returns true if one of the block's inner blocks is selected.
*
- * @param {Object} state Editor state.
- * @param {string} clientId Block client ID.
+ * @param {Object} state Editor state.
+ * @param {string} clientId Block client ID.
+ * @param {boolean} deep Perform a deep check.
*
* @return {boolean} Whether the block as an inner block selected
*/
-export function hasSelectedInnerBlock( state, clientId ) {
+export function hasSelectedInnerBlock( state, clientId, deep = false ) {
return some(
getBlockOrder( state, clientId ),
- ( innerClientId ) => isBlockSelected( state, innerClientId )
+ ( innerClientId ) => (
+ isBlockSelected( state, innerClientId ) ||
+ ( deep && hasSelectedInnerBlock( state, innerClientId, deep ) )
+ )
);
}
diff --git a/test/e2e/specs/block-deletion.test.js b/test/e2e/specs/block-deletion.test.js
index 8cd8b1c5fbbc16..d2d70eb6de337d 100644
--- a/test/e2e/specs/block-deletion.test.js
+++ b/test/e2e/specs/block-deletion.test.js
@@ -42,7 +42,7 @@ describe( 'block deletion -', () => {
describe( 'deleting the third block using the Remove Block shortcut', () => {
it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => {
- await pressWithModifier( [ 'Shift', META_KEY ], 'x' );
+ await pressWithModifier( [ 'Shift', META_KEY ], 'Backspace' );
expect( await getEditedPostContent() ).toMatchSnapshot();
// Type additional text and assert that caret position is correct by comparing to snapshot.
diff --git a/test/e2e/specs/links.test.js b/test/e2e/specs/links.test.js
index 7dd10ff5d664af..0968805fbd49d4 100644
--- a/test/e2e/specs/links.test.js
+++ b/test/e2e/specs/links.test.js
@@ -195,9 +195,9 @@ describe( 'Links', () => {
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
- const setFixedToolbar = async ( b ) => {
+ const toggleFixedToolbar = async ( b ) => {
await page.click( '.edit-post-more-menu button' );
- const button = ( await page.$x( "//button[contains(text(), 'Fix Toolbar to Top')]" ) )[ 0 ];
+ const button = ( await page.$x( "//button[contains(text(), 'Unified Toolbar')]" ) )[ 0 ];
const buttonClassNameProperty = await button.getProperty( 'className' );
const buttonClassName = await buttonClassNameProperty.jsonValue();
const isSelected = buttonClassName.indexOf( 'is-selected' ) !== -1;
@@ -208,8 +208,8 @@ describe( 'Links', () => {
}
};
- it( 'allows Left to be pressed during creation in "Fixed to Toolbar" mode', async () => {
- await setFixedToolbar( true );
+ it( 'allows Left to be pressed during creation when the toolbar is fixed to top', async () => {
+ await toggleFixedToolbar( true );
await clickBlockAppender();
await page.keyboard.type( 'Text' );
@@ -227,7 +227,7 @@ describe( 'Links', () => {
} );
it( 'allows Left to be pressed during creation in "Docked Toolbar" mode', async () => {
- await setFixedToolbar( false );
+ await toggleFixedToolbar( false );
await clickBlockAppender();
await page.keyboard.type( 'Text' );