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
[IMP] web_editor: Image shapes for themes & website configurator #73938
Conversation
3751c18
to
f289c9f
Compare
f289c9f
to
bc470af
Compare
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.
Seems to be a good work, try to finish it even faster, I'd like to merge this today 👍 You'll have to adapt some stuff according to my only comment. Also in the second commit you say:
- Update 'data-mimetype' on image to SVG since loadImageInfo()
will set the original attachment mimetype on it.
-> seems useless to mention in the commit message
- Prevent saving image as base64 when it's saved without
any changes being made.
I don't see what part of the code is doing that? And should not it be in a separate fix commit then?
Squash both commits, they are very related IMO.
bc470af
to
58fb9e0
Compare
This happens when image has a shape option + image src is not a data URL (e.g. image with a saved shape option / image with shape added by theme using the Python URL). I fixed that by adding a condition to prevent Moved now to a separate commit since it's a general issue. |
988ad8a
to
29f3e5d
Compare
29f3e5d
to
46eef9c
Compare
46eef9c
to
d78e92c
Compare
9034f95
to
17f7e8a
Compare
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 work, in the end I squashed the 3 commits and added the final xpath example in the commit message (the 3 commits made the review easier but they were really too related to be merged individually).
@robodoo r+
@qsm-odoo, you may want to rebuild or fix this PR as it has failed CI. |
17f7e8a
to
933b77a
Compare
The goal of this commit is to add a "Python version" of the shape-on-image feature using a controller. Since the whole logic to apply shapes on image is JS-based, we need to use this URL (just like for background shapes) when we want to add a shape by default on images in themes. When the configurator replaces a snippet image (which the theme defines to have a shape), the shape option should still be applied on the new image. On the JS side, loadImageInfo() is overridden in order to mark images (with theme default shapes) with corresponding attachment data (original-id, original-src, mimetype). Here is an example of the minimum xpath required to add a shape on a snippet image in a theme: ``` <template id="s_image_text" inherit_id="website.s_image_text"> <xpath expr="//img" position="attributes"> <attribute name="src">/web_editor/image_shape/website.s_image_text_default_image/web_editor/solid/blob_1_solid_rd.svg?c2=o-color-1</attribute> <attribute name="data-shape">web_editor/solid/blob_1_solid_rd</attribute> <attribute name="data-original-mimetype">image/jpeg</attribute> <attribute name="data-file-name">s_image_text.svg</attribute> <attribute name="data-shape-colors">;o-color-1;;;</attribute> </xpath> </template> ``` task-2593454
933b77a
to
4cad1ef
Compare
@robodoo r+ |
The goal of this commit is to add a "Python version" of the shape-on-image feature using a controller. Since the whole logic to apply shapes on image is JS-based, we need to use this URL (just like for background shapes) when we want to add a shape by default on images in themes. When the configurator replaces a snippet image (which the theme defines to have a shape), the shape option should still be applied on the new image. On the JS side, loadImageInfo() is overridden in order to mark images (with theme default shapes) with corresponding attachment data (original-id, original-src, mimetype). Here is an example of the minimum xpath required to add a shape on a snippet image in a theme: ``` <template id="s_image_text" inherit_id="website.s_image_text"> <xpath expr="//img" position="attributes"> <attribute name="src">/web_editor/image_shape/website.s_image_text_default_image/web_editor/solid/blob_1_solid_rd.svg?c2=o-color-1</attribute> <attribute name="data-shape">web_editor/solid/blob_1_solid_rd</attribute> <attribute name="data-original-mimetype">image/jpeg</attribute> <attribute name="data-file-name">s_image_text.svg</attribute> <attribute name="data-shape-colors">;o-color-1;;;</attribute> </xpath> </template> ``` task-2593454 closes #73938 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The goal of this PR is to add a "Python version" of the
shape on image feature using a controller.
Since the whole logic to apply shapes on image is JS based, we need
to use this URL (just like background shapes) when we want to add
a shape by default on images in themes.
When the configurator replaces a snippet image (with default shape),
the shape option should still be applied on the new one.
task-2593454