From bbdd7bf73158de0fc8cc876b61f6568e2f3400be Mon Sep 17 00:00:00 2001 From: Artemio Morales Date: Mon, 26 Feb 2024 15:09:48 -0500 Subject: [PATCH] Block Bindings: Add connection icon to list view (#59331) * Add connection icon to list view * Remove extraneous string --- .../src/components/list-view/block-select-button.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/list-view/block-select-button.js b/packages/block-editor/src/components/list-view/block-select-button.js index 6b9de943ea0bf2..bc32baf9609d69 100644 --- a/packages/block-editor/src/components/list-view/block-select-button.js +++ b/packages/block-editor/src/components/list-view/block-select-button.js @@ -14,7 +14,12 @@ import { Tooltip, } from '@wordpress/components'; import { forwardRef } from '@wordpress/element'; -import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons'; +import { + Icon, + connection, + lockSmall as lock, + pinSmall, +} from '@wordpress/icons'; import { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes'; import { useSelect, useDispatch } from '@wordpress/data'; import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts'; @@ -66,6 +71,7 @@ function ListViewBlockSelectButton( getBlockRootClientId, getBlockOrder, getBlocksByClientId, + getBlockAttributes, canRemoveBlocks, } = useSelect( blockEditorStore ); const { duplicateBlocks, multiSelect, removeBlocks } = @@ -75,6 +81,8 @@ function ListViewBlockSelectButton( const images = useListViewImages( { clientId, isExpanded } ); const { rootClientId } = useListViewContext(); + const isConnected = getBlockAttributes( clientId )?.metadata?.bindings; + const positionLabel = blockInformation?.positionLabel ? sprintf( // translators: 1: Position of selected block, e.g. "Sticky" or "Fixed". @@ -278,6 +286,7 @@ function ListViewBlockSelectButton( ) } + { isConnected && } { positionLabel && isSticky && (