Skip to content

Commit

Permalink
Fix RichText controls in 6.2.2 and 6.3 (#2545)
Browse files Browse the repository at this point in the history
fix rich-text controls in 6.2.2 and 6.3
  • Loading branch information
AnthonyLedesma authored Aug 7, 2023
1 parent 7dc9591 commit f074b69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
"lint:php": "wp-env run tests-cli --env-cwd=/var/www/html 'composer run lint -d /var/www/html/wp-content/plugins/coblocks/'; #we use phpunit container because composer container only use php 8;",
"lint:php:fix": "wp-env run tests-cli --env-cwd=/var/www/html 'composer run lint:fix -d /var/www/html/wp-content/plugins/coblocks/'; #we use phpunit container because composer container only use php 8;",
"makepot": "./vendor/bin/wp i18n make-pot . --skip-audit --exclude=\".dev,.github,.wordpress-org,build,docs,dist,node_modules,vendor,wordpress\" --headers='{\"Last-Translator\":\"plugins@godaddy.com\",\"Report-Msgid-Bugs-To\":\"https://github.com/godaddy-wordpress/coblocks/issues\"}' --file-comment=\"Copyright (c) $(date +'%Y') GoDaddy Operating Company, LLC. All Rights Reserved.\" languages/coblocks.pot && yarn run pot2json",
"php:composer:install": "wp-env run wordpress 'composer install -d /var/www/html/wp-content/plugins/coblocks/'",
"po2jed": "cd languages && find . -name '*.po' -execdir /bin/bash -c 'FROM=\"$0\" && TO=\"`basename $0 .po`-coblocks-editor.json\" && echo \"$FROM > $TO\" && po2json $FROM $TO -f jed' '{}' \\;",
"po2mo": "cd languages && find . -name '*.po' -execdir /bin/bash -c 'FROM=\"$0\" && TO=\"`basename $0 .po`.mo\" && echo \"$FROM > $TO\" && msgfmt $FROM -o $TO' '{}' \\;",
"postinstall": "yarn update:icon",
"pot2json": "./vendor/bin/pot2json languages/coblocks.pot languages/coblocks.json",
"prepare": "husky install .dev/husky",
"setup": "yarn install && yarn run build && wp-env start && yarn php:composer:install",
"setup": "yarn install && yarn run build && wp-env start",
"start:debug": "DEBUG_MODE=on wp-scripts start --progress",
"start": "wp-scripts start --progress",
"test:a11y": "node .dev/tests/a11y/pa11y.js",
Expand Down
11 changes: 5 additions & 6 deletions src/blocks/gallery-carousel/gallery-carousel-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ const GalleryCarouselItem = ( {
return (
<RichText
className="coblocks-gallery--caption coblocks-gallery--primary-caption"
inlineToolbar
isSelected={ captionFocused }
onChange={ ( val ) => handleCaptionChange( val ) }
inlineToolbar={ captionFocused }
onChange={ ( val ) => !! val ? handleCaptionChange( val ) : null }
placeholder={ __( 'Write gallery caption…', 'coblocks' ) }
tagName="figcaption"
onFocus={ () => {
setCaptionFocused( ! captionFocused );
} }
unstableOnFocus={ setCaptionFocused( true ) } // Backwards compat < WP 6.3
onFocus={ setCaptionFocused( true ) }
onBlur={ () => setCaptionFocused( false ) }
value={ images[ selectedImage ]?.caption }
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/block-gallery/gallery-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ class GalleryImage extends Component {
{ ( supportsCaption === true ) && ( ! RichText.isEmpty( caption ) || isSelected ) && captions ? (
<RichText
className="coblocks-gallery--caption"
inlineToolbar
isSelected={ captionSelected }
inlineToolbar={ captionSelected }
onChange={ ( newCaption ) => setAttributes( { caption: newCaption } ) }
placeholder={ __( 'Write caption…', 'coblocks' ) }
style={ captionStyles }
tagName="figcaption"
onFocus={ this.onSelectCaption }
unstableOnFocus={ this.onSelectCaption }
value={ caption }
/>
) : null }
Expand Down

0 comments on commit f074b69

Please sign in to comment.