Skip to content

Commit

Permalink
Remove editorMode from blockProps
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Sep 13, 2024
1 parent b0abc74 commit 75e7489
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
3 changes: 0 additions & 3 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ function BlockListBlockProvider( props ) {
) && hasSelectedInnerBlock( clientId ),
blockApiVersion: blockType?.apiVersion || 1,
blockTitle: match?.title || blockType?.title,
editorMode,
isSubtreeDisabled:
blockEditingMode === 'disabled' &&
isBlockSubtreeDisabled( clientId ),
Expand Down Expand Up @@ -730,7 +729,6 @@ function BlockListBlockProvider( props ) {
themeSupportsLayout,
isTemporarilyEditingAsBlocks,
blockEditingMode,
editorMode,
mayDisplayControls,
mayDisplayParentControls,
index,
Expand Down Expand Up @@ -785,7 +783,6 @@ function BlockListBlockProvider( props ) {
hasOverlay,
initialPosition,
blockEditingMode,
editorMode,
isHighlighted,
isMultiSelected,
isPartiallySelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
name,
blockApiVersion,
blockTitle,
editorMode,
isSelected,
isSubtreeDisabled,
hasOverlay,
Expand Down Expand Up @@ -117,7 +116,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
useFocusHandler( clientId ),
useEventHandlers( { clientId, isSelected } ),
useNavModeExit( clientId ),
useZoomOutModeExit( { editorMode } ),
useZoomOutModeExit(),
useIsHovered( { clientId } ),
useIntersectionObserver(),
useMovingAnimation( { triggerAnimationOnChange: index, clientId } ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import { unlock } from '../../../lock-unlock';
/**
* Allows Zoom Out mode to be exited by double clicking in the selected block.
*
* @param {string} clientId Block client ID.
*/
export function useZoomOutModeExit( { editorMode } ) {
const getSettings = useSelect(
( select ) => select( blockEditorStore ).getSettings
export function useZoomOutModeExit() {
const { getSettings, __unstableGetEditorMode } = useSelect( ( select ) =>
select( blockEditorStore )
);

const { __unstableSetEditorMode } = unlock(
Expand All @@ -26,12 +25,11 @@ export function useZoomOutModeExit( { editorMode } ) {

return useRefEffect(
( node ) => {
if ( editorMode !== 'zoom-out' ) {
return;
}

function onDoubleClick( event ) {
if ( ! event.defaultPrevented ) {
if (
! event.defaultPrevented &&
__unstableGetEditorMode() === 'zoom-out'
) {
event.preventDefault();

const { __experimentalSetIsInserterOpened } = getSettings();
Expand All @@ -51,6 +49,6 @@ export function useZoomOutModeExit( { editorMode } ) {
node.removeEventListener( 'dblclick', onDoubleClick );
};
},
[ editorMode, __unstableSetEditorMode ]
[ __unstableSetEditorMode, __unstableGetEditorMode ]
);
}

0 comments on commit 75e7489

Please sign in to comment.