Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add block icon
  • Loading branch information
talldan committed Sep 10, 2025
commit 04a67c27279ae7db96de367b28b3fce6055b1088
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { store as blocksStore } from '@wordpress/blocks';
import {
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
__experimentalHStack as HStack,
TextControl,
} from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
Expand All @@ -14,7 +15,9 @@ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
* Internal dependencies
*/
import { store as blockEditorStore } from '../../store';
import BlockIcon from '../block-icon';
import useBlockDisplayTitle from '../block-title/use-block-display-title';
import useBlockDisplayInformation from '../use-block-display-information';

function RichTextControl( { label, value, setValue } ) {
return (
Expand Down Expand Up @@ -121,6 +124,7 @@ function BlockControls( { clientId } ) {
clientId,
context: 'list-view',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels odd since we're not in the list view. Maybe we need to change the whatever the context is of this list-view name to something more generic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought too much about it, it's just code I lifted from the BlockQuickNavigation component.

} );
const blockInformation = useBlockDisplayInformation( clientId );

if ( ! contentAttributesWithControls?.length ) {
// TODO - we might still want to show a placeholder for blocks with no controls.
Expand All @@ -130,7 +134,12 @@ function BlockControls( { clientId } ) {

return (
<ToolsPanel
label={ blockTitle }
label={
<HStack spacing={ 1 }>
<BlockIcon icon={ blockInformation?.icon } />
<div>{ blockTitle }</div>
</HStack>
}
panelId={ clientId }
resetAll={ () => {
updateBlockAttributes(
Expand Down
Loading