Skip to content

Commit

Permalink
Caption utility component: Allow the main CSS Class Name to be exclud…
Browse files Browse the repository at this point in the history
…ed from the markup. (#62485)

* Allow the main CSS class name of the Caption utility component to be excluded in the HTML markup

* Caption utility component: change the name of the property responsible for excluding the Element CSS Class Name

----

Co-authored-by: aatanasovdev <aatanasov@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
  • Loading branch information
3 people authored Jun 17, 2024
1 parent 4413591 commit 11390a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/block-library/src/quote/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function QuoteEdit( {
}
addLabel={ __( 'Add citation' ) }
removeLabel={ __( 'Remove citation' ) }
excludeElementClassName
className="wp-block-quote__citation"
insertBlocksAfter={ insertBlocksAfter }
{ ...( ! isWebPlatform ? { textAlign } : {} ) }
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/utils/caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function Caption( {
placeholder = __( 'Add caption' ),
label = __( 'Caption text' ),
showToolbarButton = true,
excludeElementClassName,
className,
readOnly,
tagName = 'figcaption',
Expand Down Expand Up @@ -70,6 +71,7 @@ export function Caption( {
},
[ isCaptionEmpty ]
);

return (
<>
{ showToolbarButton && (
Expand All @@ -96,7 +98,9 @@ export function Caption( {
tagName={ tagName }
className={ clsx(
className,
__experimentalGetElementClassName( 'caption' )
excludeElementClassName
? ''
: __experimentalGetElementClassName( 'caption' )
) }
ref={ ref }
aria-label={ label }
Expand Down

0 comments on commit 11390a8

Please sign in to comment.