Skip to content

Conversation

@joshuatf
Copy link
Contributor

@joshuatf joshuatf commented Apr 19, 2023

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.

Screen Shot 2023-04-19 at 9 55 42 AM

Screen Shot 2023-04-19 at 9 55 29 AM

Closes #37852 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Navigate to Tools -> WCA Test Helper -> Features and enable the new product blocks editing experience
  2. Navigate to Products -> Add new
  3. Click on "Add description" under the description
  4. Add some content via the blocks editor
  5. Click "Back"
  6. Make sure the description button now reads "Edit description"
  7. Save the product
  8. Refresh the page
  9. Click "Edit description"
  10. Make sure the description has persisted

@github-actions github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Apr 19, 2023
@joshuatf joshuatf requested a review from a team April 19, 2023 17:08
@joshuatf joshuatf self-assigned this Apr 19, 2023
@github-actions
Copy link
Contributor

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2023

Test Results Summary

Commit SHA: d1a5642

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests26700202690m 50s
E2E Tests1870010019719m 49s

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.

Copy link
Contributor

@louwie17 louwie17 left a 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",
Copy link
Contributor

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.

Copy link
Contributor Author

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 ) => {
Copy link
Contributor

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?

Copy link
Contributor Author

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 );
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link

@jarekmorawski jarekmorawski Apr 25, 2023

Choose a reason for hiding this comment

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

The buttons will likely be Cancel (tertiary) and Done (primary), so Lourens's suggestion is sound. 👍 When the user edits an existing description, clicking Cancel will discard recent changes. Done will save changes and close the modal.

image

Copy link
Contributor

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 :)

Copy link
Contributor

@louwie17 louwie17 left a 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';

@joshuatf
Copy link
Contributor Author

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.

Copy link
Contributor

@louwie17 louwie17 left a 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.

@joshuatf joshuatf merged commit 48af8c1 into trunk Apr 25, 2023
@joshuatf joshuatf deleted the add/37771 branch April 25, 2023 18:05
@github-actions github-actions bot added this to the 7.8.0 milestone Apr 25, 2023
@joshuatf joshuatf mentioned this pull request May 24, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants