Skip to content

Conversation

@joshuatf
Copy link
Contributor

@joshuatf joshuatf commented Apr 5, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR adds in an IframeEditor for use in pages to allow us to edit specific sections, such as the product description, within a nested editor.

Note that some follow-ups will be needed and we'll need some design input moving forward (cc @jarekmorawski):

  • Back/exit button
  • Callback functions for onChange, onClose, etc.
  • Implementation of this block within the description
  • Updates to the design of this component

Screen Shot 2023-04-04 at 5 25 23 PM

Closes #37266 .

How to test the changes in this Pull Request:

  1. Either check out the branch add/37266-test OR add the IframeEditor component manually to a page by importing it from @woocommerce/product-editor.
  2. Navigate to Tools -> WCA Test Helper -> Features and enable the new product blocks editing experience
  3. Navigate to Products -> Add new (or where you manually added the new component)
  4. Check that blocks can be added and blocks styles exist
  5. Make sure you can resize the editor as needed

@joshuatf joshuatf requested a review from a team April 5, 2023 00:28
@joshuatf joshuatf self-assigned this Apr 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 5, 2023

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 github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Apr 5, 2023
@@ -0,0 +1,63 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this component and ResizableEditor both exist under the edit-site package in Gutenberg but are not exported.

We should consider making those consumable, but that may require significant changes on their end to make it work for our use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a TODO: comment here, or something else explicit, that mentions it being copied from the edit-site package.

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 idea! Since you're already AFK today, I'm going to go ahead and merge this though to unblock future work and we can add this comment in one of the following PRs.

height: 100%;
width: 100%;
overflow: hidden;
position: fixed;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is currently fixed, but we may want to slot fill this somewhere else into the page to position absolutely and prevent overlap with the existing editor.

More investigation needed here to determine the right solution.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 5, 2023

Test Results Summary

Commit SHA: 340d4b9

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 51s
E2E Tests1870010019714m 31s

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.

Hey @joshuatf, overall nice work on this, I did manage to get it working, but ran into several issues ( I left comments inline for those ).
Let me know what you think.

<Iframe
head={
<>
<EditorStyles />
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this takes a styles prop, or relies on one for me. It errors and blank screens without providing one.
Maybe this has been recently added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not manage to hit the error, but since we're not really passing any extra styles, I think we can remove it until we want to pass settings down.

@import 'components/header/style.scss';
@import 'components/images/editor.scss';
@import 'components/block-editor/style.scss';
@import 'components/modal-editor/style.scss';
Copy link
Contributor

Choose a reason for hiding this comment

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

This style sheet doesn't exist, which breaks the build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! Must be some funkiness after the rebase/rename. Removed.

if ( ! empty( $post_type_object->template ) ) {
$editor_settings['template'] = $post_type_object->template;
$editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;
$editor_settings['__unstableResolvedAssets'] = gutenberg_resolve_assets_override();
Copy link
Contributor

Choose a reason for hiding this comment

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

The gutenberg_resolve_assets_override is not available on a standalone WP version, and requires the Gutenberg plugin to be enabled in order to work.
We should probably wrap this in a function_exists and maybe create our own if this is required? Not sure if this would be added to WP 6.3 for example, but that be a relatively long wait.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seemed that we also rely on this function for some of the experimental components coming from @wordpress/block-editor, or maybe they were also provided by the Gutenberg plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied this function over until it's available. 55c9ccf

@codecov
Copy link

codecov bot commented Apr 15, 2023

Codecov Report

Merging #37570 (12bf0f4) into trunk (c226fa1) will decrease coverage by 0.0%.
The diff coverage is 0.0%.

❗ Current head 12bf0f4 differs from pull request most recent head 340d4b9. Consider uploading reports for the commit 340d4b9 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             trunk   #37570     +/-   ##
==========================================
- Coverage     51.6%    51.6%   -0.0%     
  Complexity   17260    17260             
==========================================
  Files          429      429             
  Lines        79928    79928             
==========================================
- Hits         41213    41212      -1     
- Misses       38715    38716      +1     
Impacted Files Coverage Δ
...ugins/woocommerce/includes/class-wc-post-types.php 1.1% <0.0%> (ø)
...ludes/tracks/events/class-wc-products-tracking.php 0.0% <ø> (ø)

... and 1 file with indirect coverage changes

@joshuatf joshuatf mentioned this pull request Apr 18, 2023
3 tasks
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 and looks good as is, it's nice that the components you needed from edit-site are also relatively small, so its not like we are copying over a huge amount of code for the short term.
I look forward to seeing this integrated.

I did leave one minor comment about mentioning in code where the copied over components are coming from, but that can be a follow up as well.

@@ -0,0 +1,63 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a TODO: comment here, or something else explicit, that mentions it being copied from the edit-site package.

@joshuatf joshuatf merged commit ebe879d into trunk Apr 18, 2023
@joshuatf joshuatf deleted the add/37266 branch April 18, 2023 17:52
@github-actions github-actions bot added this to the 7.8.0 milestone Apr 18, 2023
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.

Create Block Editor Modal window for use in product description

3 participants