Skip to content

Commit

Permalink
Revert "Block Insertion: Clear the insertion point when selecting a d…
Browse files Browse the repository at this point in the history
…ifferent block or clearing block selection (#64048)"

This reverts commit c73aa36.
  • Loading branch information
jeryj committed Sep 10, 2024
1 parent 1c44c41 commit e1455ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import clsx from 'clsx';
import { useState, useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { Button, SearchControl } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -82,8 +82,6 @@ export default function QuickInserter( {
}
}, [ setInserterIsOpened ] );

const { showInsertionPoint } = useDispatch( blockEditorStore );

// When clicking Browse All select the appropriate block so as
// the insertion point can work as expected.
const onBrowseAll = () => {
Expand All @@ -93,7 +91,6 @@ export default function QuickInserter( {
filterValue,
onSelect,
} );
showInsertionPoint( rootClientId, insertionIndex );
};

let maxBlockPatterns = 0;
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,6 @@ export function insertionPoint( state = null, action ) {
}

case 'HIDE_INSERTION_POINT':
case 'CLEAR_SELECTED_BLOCK':
case 'SELECT_BLOCK':
return null;
}

Expand Down
7 changes: 2 additions & 5 deletions packages/editor/src/components/inserter-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );

export default function InserterSidebar() {
const {
blockInsertionPoint,
blockSectionRootClientId,
inserterSidebarToggleRef,
insertionPoint,
Expand All @@ -35,7 +34,6 @@ export default function InserterSidebar() {
isPublishSidebarOpened,
} = unlock( select( editorStore ) );
const {
getBlockInsertionPoint,
getBlockRootClientId,
__unstableGetEditorMode,
getSectionRootClientId,
Expand All @@ -53,7 +51,6 @@ export default function InserterSidebar() {
return getBlockRootClientId();
};
return {
blockInsertionPoint: getBlockInsertionPoint(),
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
insertionPoint: getInsertionPoint(),
showMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),
Expand Down Expand Up @@ -92,9 +89,9 @@ export default function InserterSidebar() {
showInserterHelpPanel
shouldFocusBlock={ isMobileViewport }
rootClientId={
blockSectionRootClientId ?? blockInsertionPoint.rootClientId
blockSectionRootClientId ?? insertionPoint.rootClientId
}
__experimentalInsertionIndex={ blockInsertionPoint.index }
__experimentalInsertionIndex={ insertionPoint.insertionIndex }
onSelect={ insertionPoint.onSelect }
__experimentalInitialTab={ insertionPoint.tab }
__experimentalInitialCategory={ insertionPoint.category }
Expand Down

0 comments on commit e1455ab

Please sign in to comment.