-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add IframeEditor component to product editor #37570
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: |
| @@ -0,0 +1,63 @@ | |||
| /** | |||
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.
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.
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.
Maybe we should add a TODO: comment here, or something else explicit, that mentions it being copied from the edit-site package.
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 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; |
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 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.
Test Results SummaryCommit SHA: 340d4b9
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.
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 /> |
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.
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?
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.
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'; |
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 style sheet doesn't exist, which breaks the build
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.
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(); |
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.
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.
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.
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.
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.
Copied this function over until it's available. 55c9ccf
Codecov Report
Additional details and impacted files@@ 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
|
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 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 @@ | |||
| /** | |||
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.
Maybe we should add a TODO: comment here, or something else explicit, that mentions it being copied from the edit-site package.
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR adds in an
IframeEditorfor 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):
onChange,onClose, etc.Closes #37266 .
How to test the changes in this Pull Request:
add/37266-testOR add theIframeEditorcomponent manually to a page by importing it from@woocommerce/product-editor.