-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add the product description block and callbacks for the IframeEditor #37852
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
Conversation
|
Hi , @woocommerce/mothra Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: d1a5642
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
louwie17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @joshuatf, this tested well!
I just left some minor suggestions, but otherwise loving the process on this :)
| { | ||
| "$schema": "https://schemas.wp.org/trunk/block.json", | ||
| "apiVersion": 2, | ||
| "name": "woocommerce/product-description", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given @mdperez86 just merged the update block names PR: #37851 we should change this to woocommerce/product-description-field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
| updateSettings( productBlockEditorSettings ); | ||
| }, [] ); | ||
|
|
||
| const debouncedOnChange = debounce( ( updatedBlocks ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using the lodash version of debounce could you make use of useDebounce from @wordpress/compose instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Updated in 581ec9a
| initialBlocks={ parse( description ) } | ||
| onChange={ ( blocks ) => { | ||
| const html = serialize( blocks ); | ||
| setDescription( html ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should do for now I think, but we may want to move this to the onClose method depending on what the Modal button say's. As we may want users to still cancel out of the editing modal without there changes being reflected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It looks like we don't have that option yet in the designs, but we did discuss with @jarekmorawski in the last design call.
If we end up introducing something else, we will likely introduce an onUpdate method to supplement this and set the description there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All sounds good with me, that can be done as a follow up. Thanks for the additional context @jarekmorawski :)
louwie17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @joshuatf this looks great!
Although there was one bug, which may of cropped up during the rebase, as it wasn't registering the description field anymore.
I assume you may of accidentally removed the export from the blocks/index.ts file:
export { init as initDescription } from './description';
I hadn't added this yet. The way these were imported/exported just changed a few days ago. I guess my pnpm did not rebuild properly after rebase. Added in d1a5642 and built fresh with pnpm to make sure things are working. |
louwie17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 Thanks for adding the import.

Submission Review Guidelines:
Changes proposed in this Pull Request:
Adds the product description block and callbacks to the IframeEditor component to allow it to be used in this block.
A follow-up will address the preview for the description content.
Closes #37852 .
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions: