Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ function BlockListBlockProvider( props ) {
getBlockAttributes,
canRemoveBlock,
canMoveBlock,
hasBlockSpotlight,

getSettings,
getTemporarilyEditingAsBlocks,
Expand Down Expand Up @@ -711,7 +710,6 @@ function BlockListBlockProvider( props ) {
? blocksWithSameName[ 0 ]
: false,
isBlockHidden: _isBlockHidden( clientId ),
hasBlockSpotlight: hasBlockSpotlight( clientId ),
};
},
[ clientId, rootClientId ]
Expand Down Expand Up @@ -755,7 +753,6 @@ function BlockListBlockProvider( props ) {
defaultClassName,
originalBlockClientId,
isBlockHidden,
hasBlockSpotlight,
} = selectedProps;

// Users of the editor.BlockListBlock filter used to be able to
Expand Down Expand Up @@ -805,7 +802,6 @@ function BlockListBlockProvider( props ) {
themeSupportsLayout,
canMove,
isBlockHidden,
hasBlockSpotlight,
};

if (
Expand Down
19 changes: 0 additions & 19 deletions packages/block-editor/src/components/block-list/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -315,25 +315,6 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
}
}

// Highlights a block with a spotlight. Fades out all other blocks.
.is-root-container:has(.is-spotlighted) {
.block-editor-block-list__block:not(.has-child-selected) {
opacity: 0.2;
@media not ( prefers-reduced-motion ) {
transition: opacity 0.1s linear;
}

// Nested blocks should never be faded. If the parent block is already faded
// out, it shouldn't be faded out more. If the parent block in not faded
// out, it shouldn't be faded out either because the block as a whole,
// including inner blocks, should be focused.
.block-editor-block-list__block,
&.is-spotlighted {
opacity: 1;
}
}
}

.wp-block[data-align="left"] > *,
.wp-block[data-align="right"] > *,
.wp-block.alignleft,
Expand Down
10 changes: 7 additions & 3 deletions packages/block-editor/src/components/block-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
function Root( { className, ...settings } ) {
const { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } =
useSelect( ( select ) => {
const { getSettings, getTemporarilyEditingAsBlocks, isTyping } =
unlock( select( blockEditorStore ) );
const {
getSettings,
getTemporarilyEditingAsBlocks,
isTyping,
hasBlockSpotlight,
} = unlock( select( blockEditorStore ) );
const { outlineMode, focusMode } = getSettings();
return {
isOutlineMode: outlineMode && ! isTyping(),
isFocusMode: focusMode,
isFocusMode: focusMode || hasBlockSpotlight(),
temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks(),
};
}, [] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
isSectionBlock,
canMove,
isBlockHidden,
hasBlockSpotlight,
} = useContext( PrivateBlockContext );

// translators: %s: Type of block (i.e. Text, Image etc)
Expand Down Expand Up @@ -186,7 +185,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
'is-content-locked-temporarily-editing-as-blocks':
isTemporarilyEditingAsBlocks,
'is-block-hidden': isBlockHidden,
'is-spotlighted': hasBlockSpotlight,
},
className,
props.className,
Expand Down
7 changes: 3 additions & 4 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,10 @@ export const isBlockHidden = ( state, clientId ) => {
/**
* Returns true if the current spotlighted block matches the block clientId.
*
* @param {Object} state Global application state.
* @param {string} clientId The block to check.
* @param {Object} state Global application state.
*
* @return {boolean} Whether the block is currently spotlighted.
*/
export function hasBlockSpotlight( state, clientId ) {
return state.hasBlockSpotlight === clientId;
export function hasBlockSpotlight( state ) {
return !! state.hasBlockSpotlight;
}
Loading