Skip to content

Commit

Permalink
Table Block: Hide caption toolbar button on multiple selection (#64462)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
3 people authored Aug 13, 2024
1 parent 943b72a commit 600aa54
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 600aa54

Please sign in to comment.