[FIX] web_editor: allow recropping a newly cropped image
Since https://github.com/odoo/odoo/commit/a473453b3166a381130d9bd6ec4851b9e1ecab26, a newly cropped image gets a base64 src until the user choose to save the page (where we create an attachment for the cropped picture). The problem is that when reentering the crop edition at once... it was not able to be performed because we did not handle base64 images there. This commit solves this and accidentally adds a feature: allow cropping base64 images.
This commit is contained in:
@@ -1589,10 +1589,10 @@ var CropImageDialog = Dialog.extend({
|
||||
];
|
||||
this.imageData = {
|
||||
imageSrc: src,
|
||||
originalSrc: src, // the original src for cropped DB images will be fetched later
|
||||
mimetype: _.str.endsWith(src, '.png') ? 'image/png' : 'image/jpeg', // the mimetype for DB images will be fetched later
|
||||
originalSrc: this.$media.data('crop:originalSrc') || src, // the original src for cropped DB images will be fetched later
|
||||
mimetype: this.$media.data('crop:mimetype') || (_.str.endsWith(src, '.png') ? 'image/png' : 'image/jpeg'), // the mimetype for DB images will be fetched later
|
||||
aspectRatio: this.$media.data('aspectRatio') || this.aspectRatioList[0][1],
|
||||
isExternalImage: src[0] !== '/' && src.indexOf(window.location.host) < 0,
|
||||
isExternalImage: src.substr(0, 5) !== 'data:' && src[0] !== '/' && src.indexOf(window.location.host) < 0,
|
||||
};
|
||||
this.options = _.extend({
|
||||
title: _t("Crop Image"),
|
||||
|
||||
Reference in New Issue
Block a user