Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caption utility component: Allow the main CSS Class Name to be excluded from the markup. #62485

Merged
Merged
Show file tree
Hide file tree
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
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' ) }
excludeMainElementClassName
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,
excludeMainElementClassName,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the naming of the prop could be simplified:

Suggested change
excludeMainElementClassName,
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' )
excludeMainElementClassName
? ''
: __experimentalGetElementClassName( 'caption' )
) }
ref={ ref }
aria-label={ label }
Expand Down
Loading