diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-06-22 12:58:40 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-06-22 17:09:54 +0200 |
| commit | a17cd938640a0597f6a9781bb6b8b4b6abafbded (patch) | |
| tree | 446231755eeb69562a7ea8f7d70489c6f2fc48a0 | |
| parent | 6209b129377735a67e5ada990ca2261175a17e74 (diff) | |
[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.
| -rw-r--r-- | addons/web_editor/static/src/js/widgets/widgets.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index d7662951999..92ebf9ec4fe 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -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"), |
