[FIX] web_editor, website: use dataset mimetype when modifying images
Since [1] the mimetype used when calling `modify_image` was obtained from the data URL contained in the `src` attribute instead of the dataset. This is wrong for background images because they do not have an `src` attribute. Thanks to [2] which repaired the value contained in `dataset.mimetype`, this value can be used as it was before [1]. [1]: https://github.com/odoo/odoo/commit/0449fe85cb0e1d639a4e1aeba26e90906f79254d [2]: https://github.com/odoo/odoo/commit/40811e72c50faf146ccdf9f26c332db9ebc69fa9 task-3446438 closes odoo/odoo#130322 X-original-commit: e3221fe5d5efa824365210f040e93654e0a30309 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
@@ -2960,7 +2960,7 @@ export class Wysiwyg extends Component {
|
||||
res_id: parseInt(resId),
|
||||
data: (isBackground ? el.dataset.bgSrc : el.getAttribute('src')).split(',')[1],
|
||||
alt_data: altData,
|
||||
mimetype: el.getAttribute('src').split(":")[1].split(";")[0],
|
||||
mimetype: el.dataset.mimetype,
|
||||
name: (el.dataset.fileName ? el.dataset.fileName : null),
|
||||
},
|
||||
);
|
||||
|
||||
@@ -99,6 +99,29 @@ wTourUtils.registerWebsitePreviewTour('snippet_background_edition', {
|
||||
wTourUtils.dragNDrop(snippets[0]),
|
||||
wTourUtils.clickOnSnippet(snippets[0]),
|
||||
|
||||
// Set background image and save.
|
||||
{
|
||||
content: "Click on camera icon",
|
||||
trigger: ".snippet-option-ColoredLevelBackground we-button.fa-camera",
|
||||
},
|
||||
{
|
||||
content: "Click on image",
|
||||
trigger: ".o_select_media_dialog img[title='test.png']",
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
{
|
||||
content: "Check that the image is set",
|
||||
trigger: `iframe section.${snippets[0].id} img[data-original-id]`,
|
||||
isCheck: true,
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet(snippets[0]),
|
||||
// Remove background image.
|
||||
{
|
||||
content: "Click on camera icon",
|
||||
trigger: ".snippet-option-ColoredLevelBackground we-button.fa-camera",
|
||||
},
|
||||
|
||||
// Add a color combination
|
||||
...checkAndUpdateBackgroundColor({
|
||||
changeType: 'cc',
|
||||
|
||||
Reference in New Issue
Block a user