From 5c568d833cf5565248c1ea336e64d0a01f4d2751 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Wed, 21 Dec 2022 14:28:06 +0000 Subject: [PATCH] Remove Block Inspector Button --- .../block-inspector-button/index.js | 38 ------------------- .../block-inspector-button/style.scss | 21 ---------- .../components/sidebar-block-editor/index.js | 11 ------ packages/customize-widgets/src/style.scss | 1 - .../src/components/visual-editor/index.js | 7 ---- .../src/components/block-editor/index.js | 7 ---- 6 files changed, 85 deletions(-) delete mode 100644 packages/customize-widgets/src/components/block-inspector-button/index.js delete mode 100644 packages/customize-widgets/src/components/block-inspector-button/style.scss diff --git a/packages/customize-widgets/src/components/block-inspector-button/index.js b/packages/customize-widgets/src/components/block-inspector-button/index.js deleted file mode 100644 index c68c2f46c7468c..00000000000000 --- a/packages/customize-widgets/src/components/block-inspector-button/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * WordPress dependencies - */ -import { useMemo } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; -import { MenuItem } from '@wordpress/components'; -import { useSelect } from '@wordpress/data'; -import { store as blockEditorStore } from '@wordpress/block-editor'; - -function BlockInspectorButton( { inspector, closeMenu, ...props } ) { - const selectedBlockClientId = useSelect( - ( select ) => select( blockEditorStore ).getSelectedBlockClientId(), - [] - ); - - const selectedBlock = useMemo( - () => document.getElementById( `block-${ selectedBlockClientId }` ), - [ selectedBlockClientId ] - ); - - return ( - { - // Open the inspector. - inspector.open( { - returnFocusWhenClose: selectedBlock, - } ); - // Then close the dropdown menu. - closeMenu(); - } } - { ...props } - > - { __( 'Show more settings' ) } - - ); -} - -export default BlockInspectorButton; diff --git a/packages/customize-widgets/src/components/block-inspector-button/style.scss b/packages/customize-widgets/src/components/block-inspector-button/style.scss deleted file mode 100644 index b9a4f0f85d13a0..00000000000000 --- a/packages/customize-widgets/src/components/block-inspector-button/style.scss +++ /dev/null @@ -1,21 +0,0 @@ -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector { - background: $white; - box-sizing: border-box; - - * { - box-sizing: inherit; - } - - .block-editor-block-inspector { - margin: -$grid-unit-15; - - // To override the style in block-editor/block-inspector. - h3 { - margin-bottom: 0; - } - } -} - -#customize-theme-controls .customize-pane-child.control-section-sidebar.is-sub-section-open { - transform: translateX(-100%); -} diff --git a/packages/customize-widgets/src/components/sidebar-block-editor/index.js b/packages/customize-widgets/src/components/sidebar-block-editor/index.js index 6a5a734bef9db1..6b04c09c4740ad 100644 --- a/packages/customize-widgets/src/components/sidebar-block-editor/index.js +++ b/packages/customize-widgets/src/components/sidebar-block-editor/index.js @@ -13,7 +13,6 @@ import { ObserveTyping, WritingFlow, BlockEditorKeyboardShortcuts, - __unstableBlockSettingsMenuFirstItem, __unstableEditorStyles as EditorStyles, } from '@wordpress/block-editor'; import { uploadMedia } from '@wordpress/media-utils'; @@ -22,7 +21,6 @@ import { store as preferencesStore } from '@wordpress/preferences'; /** * Internal dependencies */ -import BlockInspectorButton from '../block-inspector-button'; import Header from '../header'; import useInserter from '../inserter/use-inserter'; import SidebarEditorProvider from './sidebar-editor-provider'; @@ -137,15 +135,6 @@ export default function SidebarBlockEditor( { inspector.contentContainer[ 0 ] ) } - - <__unstableBlockSettingsMenuFirstItem> - { ( { onClose } ) => ( - - ) } - ); } diff --git a/packages/customize-widgets/src/style.scss b/packages/customize-widgets/src/style.scss index 3bf341c34c0eb1..b8c9d9db3ebe0d 100644 --- a/packages/customize-widgets/src/style.scss +++ b/packages/customize-widgets/src/style.scss @@ -1,4 +1,3 @@ -@import "./components/block-inspector-button/style.scss"; @import "./components/header/style.scss"; @import "./components/inserter/style.scss"; @import "./components/keyboard-shortcut-help-modal/style.scss"; diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index ab708d3e87dbf5..5bfc2b68b7c0d3 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -20,7 +20,6 @@ import { __unstableUseTypewriter as useTypewriter, __unstableUseClipboardHandler as useClipboardHandler, __unstableUseTypingObserver as useTypingObserver, - __unstableBlockSettingsMenuFirstItem, __experimentalUseResizeCanvas as useResizeCanvas, __unstableEditorStyles as EditorStyles, useSetting, @@ -43,7 +42,6 @@ import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies */ -import BlockInspectorButton from './block-inspector-button'; import { store as editPostStore } from '../../store'; function MaybeIframe( { @@ -400,11 +398,6 @@ export default function VisualEditor( { styles } ) { - <__unstableBlockSettingsMenuFirstItem> - { ( { onClose } ) => ( - - ) } - ); } diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 0f39f771a5d360..1694169f30fbec 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -20,7 +20,6 @@ import { BlockInspector, BlockTools, __unstableBlockToolbarLastItem, - __unstableBlockSettingsMenuFirstItem, __unstableUseTypingObserver as useTypingObserver, BlockEditorKeyboardShortcuts, store as blockEditorStore, @@ -43,7 +42,6 @@ import TemplatePartConverter from '../template-part-converter'; import NavigateToLink from '../navigate-to-link'; import { SidebarInspectorFill } from '../sidebar-edit-mode'; import { store as editSiteStore } from '../../store'; -import BlockInspectorButton from './block-inspector-button'; import BackButton from './back-button'; import ResizableEditor from './resizable-editor'; import EditorCanvas from './editor-canvas'; @@ -251,11 +249,6 @@ export default function BlockEditor( { setIsInserterOpen } ) { /> - <__unstableBlockSettingsMenuFirstItem> - { ( { onClose } ) => ( - - ) } - <__unstableBlockToolbarLastItem> <__unstableBlockNameContext.Consumer> { ( blockName ) =>