Check if blocks have been added to rich text editors before updating value (#35626)

* Check if blocks have been added to rich text editors before updating value

* Add changelog entry
This commit is contained in:
Joshua T Flowers 2022-11-17 10:06:10 -08:00 committed by GitHub
parent fc56dcf6e9
commit ba91c94ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -213,6 +213,9 @@ export const ProductDetailsSection: React.FC = () => {
blocks={ summaryBlocks }
onChange={ ( blocks ) => {
setSummaryBlocks( blocks );
if ( ! summaryBlocks.length ) {
return;
}
setValue(
'short_description',
serialize( blocks )
@ -224,6 +227,9 @@ export const ProductDetailsSection: React.FC = () => {
blocks={ descriptionBlocks }
onChange={ ( blocks ) => {
setDescriptionBlocks( blocks );
if ( ! descriptionBlocks.length ) {
return;
}
setValue( 'description', serialize( blocks ) );
} }
placeholder={ __(

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Check if blocks have been added to rich text editors before updating value