From 3922c1fdea553d990659b39fdd3d64faba213dce Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 10 Sep 2024 09:55:42 -0500 Subject: [PATCH] Revert "Block Insertion: Clear the insertion point when selecting a different block or clearing block selection (#64048)" (#65208) This reverts commit c73aa361c4bd82d8b3ee004e5195a22158cad1bf. --- .../block-editor/src/components/inserter/quick-inserter.js | 5 +---- packages/block-editor/src/store/reducer.js | 2 -- packages/editor/src/components/inserter-sidebar/index.js | 7 ++----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/block-editor/src/components/inserter/quick-inserter.js b/packages/block-editor/src/components/inserter/quick-inserter.js index 0852c562828a4b..e28ae1f3896c45 100644 --- a/packages/block-editor/src/components/inserter/quick-inserter.js +++ b/packages/block-editor/src/components/inserter/quick-inserter.js @@ -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 @@ -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 = () => { @@ -93,7 +91,6 @@ export default function QuickInserter( { filterValue, onSelect, } ); - showInsertionPoint( rootClientId, insertionIndex ); }; let maxBlockPatterns = 0; diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js index 91d853a50a6a42..cd4569c45e5801 100644 --- a/packages/block-editor/src/store/reducer.js +++ b/packages/block-editor/src/store/reducer.js @@ -1624,8 +1624,6 @@ export function insertionPoint( state = null, action ) { } case 'HIDE_INSERTION_POINT': - case 'CLEAR_SELECTED_BLOCK': - case 'SELECT_BLOCK': return null; } diff --git a/packages/editor/src/components/inserter-sidebar/index.js b/packages/editor/src/components/inserter-sidebar/index.js index fef5e54e52f68f..b98770b7afe8fa 100644 --- a/packages/editor/src/components/inserter-sidebar/index.js +++ b/packages/editor/src/components/inserter-sidebar/index.js @@ -22,7 +22,6 @@ const { PrivateInserterLibrary } = unlock( blockEditorPrivateApis ); export default function InserterSidebar() { const { - blockInsertionPoint, blockSectionRootClientId, inserterSidebarToggleRef, insertionPoint, @@ -35,7 +34,6 @@ export default function InserterSidebar() { isPublishSidebarOpened, } = unlock( select( editorStore ) ); const { - getBlockInsertionPoint, getBlockRootClientId, __unstableGetEditorMode, getSectionRootClientId, @@ -53,7 +51,6 @@ export default function InserterSidebar() { return getBlockRootClientId(); }; return { - blockInsertionPoint: getBlockInsertionPoint(), inserterSidebarToggleRef: getInserterSidebarToggleRef(), insertionPoint: getInsertionPoint(), showMostUsedBlocks: get( 'core', 'mostUsedBlocks' ), @@ -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 }