Skip to content
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

Admin, add trix editor to product description editor (both new and edit) #11140

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Jun 29, 2023

What? Why?

Also, I've factorized custom tab, in order to have common rules for both shopfront product modal and custom tab.

New
Capture d’écran 2023-08-11 à 16 30 58
Editing
Capture d’écran 2023-08-11 à 16 30 26
Product modal in shopfront
Capture d’écran 2023-08-11 à 16 30 37
Custom tab edition
Capture d’écran 2023-08-11 à 16 30 44
Custom tab in shopfront
Capture d’écran 2023-08-11 à 16 30 50

What should we test?

We should test that htmlized product description is still well designed, so we need to test before and after content has been modified by shop manager.

Before staging the PR
  • Prepare some product description with all options (strong, italic, ...)
  • Observe the rendering on shop and on modal (when clicking on a product description)
After staging the PR
  • Check that the rendering for all product is still the same
  • Then, go to a production description edition, and modify.
  • Check that the rendering is still accurate
Test that the custom tab edition (in admin) is accurate to custom tab viewing (in shopfront)

Release notes

Changelog Category: User facing changes

@jibees jibees self-assigned this Jun 29, 2023
@jibees jibees marked this pull request as ready for review June 29, 2023 07:48
@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch from dd80f3e to c04f29a Compare June 29, 2023 07:49
Copy link
Member

@mkllnk mkllnk 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! ✨

@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch from c04f29a to e413a16 Compare July 6, 2023 14:42
@jibees jibees requested a review from mkllnk July 6, 2023 20:24
Comment on lines +6 to +7
this.#trixInitialize();
window.addEventListener("trix-initialize", this.#trixInitialize);
Copy link
Collaborator

@rioug rioug Jul 7, 2023

Choose a reason for hiding this comment

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

Do we need both line here ? You would think the listener on trix-initialize would be enough ?

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 thought so, and that's the normal way of doing it. Unfortunately, for some reasons, trix-initialize can be triggered before the stimulus controller is connected to the trixeditor. But, sometimes, that's the opposite. That's why I've added the two ways....

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tricky one, I can't think of any other solution 🤷‍♂️

@drummer83 drummer83 self-assigned this Aug 3, 2023
@drummer83 drummer83 added the no-staging-AU A tag which does not trigger deployments, indicating a server is being used label Aug 3, 2023
@drummer83
Copy link
Contributor

Hi @jibees,
There is a conflict here. I will move this back to In Dev for a resolution.

@drummer83 drummer83 removed the no-staging-AU A tag which does not trigger deployments, indicating a server is being used label Aug 3, 2023
@drummer83 drummer83 removed their assignment Aug 3, 2023
@mkllnk mkllnk force-pushed the 11129-add-trix-editor-to-product-description-editor branch from f3e49af to e05633a Compare August 3, 2023 22:51
@mkllnk
Copy link
Member

mkllnk commented Aug 3, 2023

I resolved the conflicts.

@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch 2 times, most recently from 4fce3ff to b970339 Compare August 8, 2023 13:22
@jibees
Copy link
Contributor Author

jibees commented Aug 8, 2023

I resolved the (others ones) conflicts.

@drummer83 drummer83 self-assigned this Aug 10, 2023
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label Aug 10, 2023
@drummer83
Copy link
Contributor

drummer83 commented Aug 10, 2023

Hi @jibees,
I like the new editor. Looking great! 💪

Before staging

image

After staging

There are a few little things we should fix before merging.

First of all we should update the page /admin/products/new at the same time. Otherwise we might end up in a mess and it was requested in the issue: #11129 (comment).

In the shopfront:

  1. If possible a link should open in a new tab.
  2. The header should be bigger (in my opinion).
  3. Ordered lists (1., 2., 3.) are not displayed in the shopfront.
    image

In the editor:

  1. When adding an unordered list, a horizontal line is displayed instead.
    image

The good thing is: Previously formatted descriptions are still displayed nicely, just underlined is not supported anymore. 👍

I will move this back to In Dev to fix the last bits.

Thanks! 🙏

@drummer83 drummer83 removed the pr-staged-au staging.openfoodnetwork.org.au label Aug 10, 2023
@drummer83 drummer83 removed their assignment Aug 10, 2023
@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch from b970339 to c4d0742 Compare August 11, 2023 08:47
@jibees jibees changed the title Admin, add trix editor to product description editor Admin, add trix editor to product description editor (both new and edit) Aug 11, 2023
@jibees
Copy link
Contributor Author

jibees commented Aug 11, 2023

Thanks @drummer83
Made some changes, this needs some Code Review one again. Sorry!

@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch from 991adca to 2ff2a5a Compare August 11, 2023 14:35
@jibees jibees requested review from mkllnk and rioug August 11, 2023 14:42
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

I like the use of the shared CSS. Thanks.

@drummer83
Copy link
Contributor

Hi @jibees,
Sorry we have a conflict here (again).
I will to In Dev to resolve it.
Thanks!

@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch 3 times, most recently from 2400d9c to 0884887 Compare September 4, 2023 13:32
@jibees jibees force-pushed the 11129-add-trix-editor-to-product-description-editor branch from 0884887 to b6b64e9 Compare September 4, 2023 13:46
@jibees
Copy link
Contributor Author

jibees commented Sep 4, 2023

Hi @jibees, Sorry we have a conflict here (again). I will to In Dev to resolve it. Thanks!

@drummer83
👋
Back into Test Ready !

@drummer83 drummer83 self-assigned this Sep 4, 2023
@drummer83 drummer83 added no-staging-AU A tag which does not trigger deployments, indicating a server is being used pr-staged-au staging.openfoodnetwork.org.au and removed no-staging-AU A tag which does not trigger deployments, indicating a server is being used pr-staged-au staging.openfoodnetwork.org.au labels Sep 4, 2023
@drummer83
Copy link
Contributor

drummer83 commented Sep 4, 2023

Thanks, @jibees!

Here we go again.

Shopfront ✔️

Before:
image

After:
image

Product modal ✔️

Before:
image

After:
image

Edit product ✔️

Before:
image

After:
image

Create new product ✔️

Before:
image

After:
image

Newly created product ✔️

After:
image

Custom tab ✔️

Before:
image

After:
The header is much smaller now.
image

Lists ❓

Before:
Same as after.

After:
Unordered and ordered lists have different margins (out of scope here, not a regression).
image

Conclusion

Great! This seems to work very well now! 🎉
Two minor things which I will add to the wishlist because they are no bugs and no regressions:

  1. Increase the size of the header. ➡️ wishlist #467
  2. Make styles (margins) of ordered and unordered lists the same. ➡️ [Trix] Unordered and ordered lists are not designed uniformly (different margin) #11491

Those things are out of scope here and this is ready to merge! 🚀
Thanks again!

@drummer83 drummer83 merged commit 406577e into openfoodfoundation:master Sep 4, 2023
56 checks passed
@sigmundpetersen sigmundpetersen removed the pr-staged-au staging.openfoodnetwork.org.au label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Trix editor to Product Description Editor
5 participants