From b6178b74f42ade43b864ac667a42cd4666bd057e Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov <38669058+aatanasovdev@users.noreply.github.com> Date: Mon, 17 Jun 2024 07:08:05 +0300 Subject: [PATCH] Caption utility component: Allow the main CSS Class Name to be excluded 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 Co-authored-by: talldan --- packages/block-library/src/quote/edit.js | 1 + packages/block-library/src/utils/caption.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/quote/edit.js b/packages/block-library/src/quote/edit.js index d712f9691ee54b..66f8f9d66c85ae 100644 --- a/packages/block-library/src/quote/edit.js +++ b/packages/block-library/src/quote/edit.js @@ -121,6 +121,7 @@ export default function QuoteEdit( { } addLabel={ __( 'Add citation' ) } removeLabel={ __( 'Remove citation' ) } + excludeElementClassName className="wp-block-quote__citation" insertBlocksAfter={ insertBlocksAfter } { ...( ! isWebPlatform ? { textAlign } : {} ) } diff --git a/packages/block-library/src/utils/caption.js b/packages/block-library/src/utils/caption.js index 2c653a9cc7fb8c..82e951d4813eb1 100644 --- a/packages/block-library/src/utils/caption.js +++ b/packages/block-library/src/utils/caption.js @@ -32,6 +32,7 @@ export function Caption( { placeholder = __( 'Add caption' ), label = __( 'Caption text' ), showToolbarButton = true, + excludeElementClassName, className, readOnly, tagName = 'figcaption', @@ -70,6 +71,7 @@ export function Caption( { }, [ isCaptionEmpty ] ); + return ( <> { showToolbarButton && ( @@ -96,7 +98,9 @@ export function Caption( { tagName={ tagName } className={ clsx( className, - __experimentalGetElementClassName( 'caption' ) + excludeElementClassName + ? '' + : __experimentalGetElementClassName( 'caption' ) ) } ref={ ref } aria-label={ label }