Skip to content

Commit

Permalink
Zoom Out: Replace deprecated selector (WordPress#63144)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ellatrix <[email protected]>
  • Loading branch information
3 people authored Jul 5, 2024
1 parent 938a513 commit 2c5f768
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ function ZoomOutModeInserters() {
sectionRootClientId,
insertionPoint,
setInserterIsOpened,
selectedSection,
hasSelection,
} = useSelect( ( select ) => {
const { getSettings, getBlockOrder } = select( blockEditorStore );
const { getSettings, getBlockOrder, getSelectionStart } =
select( blockEditorStore );
const { sectionRootClientId: root } = unlock( getSettings() );
// To do: move ZoomOutModeInserters to core/editor.
// Or we perhaps we should move the insertion point state to the
Expand All @@ -33,7 +34,7 @@ function ZoomOutModeInserters() {
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const editor = select( 'core/editor' );
return {
selectedSection: editor.getSelectedBlock(),
hasSelection: !! getSelectionStart().clientId,
blockOrder: getBlockOrder( root ),
insertionPoint: unlock( editor ).getInsertionPoint(),
sectionRootClientId: root,
Expand Down Expand Up @@ -63,7 +64,7 @@ function ZoomOutModeInserters() {
};
}, [] );

if ( ! isReady || ! selectedSection ) {
if ( ! isReady || ! hasSelection ) {
return null;
}

Expand Down

0 comments on commit 2c5f768

Please sign in to comment.