Skip to content

Commit

Permalink
Table Block: Hide caption toolbar button on multiple selection
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Aug 13, 2024
1 parent 926e738 commit fe8106c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/block-library/src/table/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function TableEdit( {
attributes,
setAttributes,
insertBlocksAfter,
isSelected,
isSelected: isSingleSelected,
} ) {
const { hasFixedLayout, head, foot } = attributes;
const [ initialRowCount, setInitialRowCount ] = useState( 2 );
Expand Down Expand Up @@ -340,10 +340,10 @@ function TableEdit( {
}

useEffect( () => {
if ( ! isSelected ) {
if ( ! isSingleSelected ) {
setSelectedCell();
}
}, [ isSelected ] );
}, [ isSingleSelected ] );

useEffect( () => {
if ( hasTableCreated ) {
Expand Down Expand Up @@ -565,9 +565,10 @@ function TableEdit( {
<Caption
attributes={ attributes }
setAttributes={ setAttributes }
isSelected={ isSelected }
isSelected={ isSingleSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Table caption text' ) }
showToolbarButton={ isSingleSelected }
/>
) }
</figure>
Expand Down

0 comments on commit fe8106c

Please sign in to comment.