Romain Derie 318dde2029 [FIX] web_editor, website: hide animation option when cors protected img
Before this commit, the "on hover" animation option would be shown for
images of type url-attachment-redirect.
Selecting that "On Hover" option value would result in a crash if the
image was CORS protected (which is often the case).

Steps to reproduce:
- Drag & drop "Text - Image" snippet
- Double click on an image to replace it
- Select in the media dialog "Add URL" and insert a CORS protected
  image URL
- The image is correctly added, and its url is something like
  `/web/image/123-redirect/xxx.jpg`
- Click on the image and then click on its "Animation" option and select
  "on hover" as value
-> It crashes

The same error will happen with absolute URL of a CORS protected image
(instead of the relative local redirect attachment-url
`/web/image/123-redirect/xxx.jpg`).

Technical stack:
> the XML option `data-animation-mode="onHover"`
  > call the js method `animationMode()`
    > calls `trigger_up('enable_hover_effect')`
      > calls `setImgShape()`
        > calls `_applyShapeAndColors()`
          > calls `_writeShape()`
            > calls `applyModifications()`
              > calls `loadImage()` which fails to load the image

-----------

Technical note: JS `fetch()` takes advantage of the browser cache, no
need to create a `Map` cache for it, despite the `_computeVisibility()`
method being called multiple times.

----------

Related to commit [1].
The code is failing since commit [2] which added the "On hover" image
animation.

Other animation values won't fail. And not-cors-protected images will
work fine with the on hover option.

[1]: https://github.com/odoo/odoo/commit/f0fe283c761cd6b1d7293dd41795ac6fc721e341
[2]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85

closes odoo/odoo#146732

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-12-26 07:33:27 +00:00
2023-11-02 21:02:44 +00:00
2023-12-21 10:42:50 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%