From f79b00c3b71e02f73537cb17285a6902fc0906b5 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 25 Jan 2018 13:33:19 +0100 Subject: [PATCH] [FIX] portal, web_editor: responsive images but with inline display Commit https://github.com/odoo/odoo/commit/abde8bddf8ec45cf12aab59e95c330321158cfba made a small change to make all images responsive when they are added with the editor. This had however the side effect of making them go to a new line which may not be what we want. --- addons/portal/static/src/less/portal.less | 4 ++++ addons/web_editor/static/src/js/widgets/widgets.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/portal/static/src/less/portal.less b/addons/portal/static/src/less/portal.less index 2dc8fa83c84..e6344b3d5d9 100644 --- a/addons/portal/static/src/less/portal.less +++ b/addons/portal/static/src/less/portal.less @@ -152,6 +152,10 @@ img, .media_iframe_video, .o_image { margin-right: @grid-gutter-width / 2; } } +img { + // Make all images responsive by default but with inline-block display + .img-responsive(inline-block); +} // Others ::-moz-selection { diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index bb8f5d9cfb7..6791a21f721 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -286,7 +286,7 @@ var ImageWidget = MediaWidget.extend({ var img = this.images[0]; if (!img.isDocument) { if (!this.$media.is('img')) { - this._replaceMedia($('', {class: 'img img-responsive'})); + this._replaceMedia($('')); } this.$media.attr('src', img.src); } else { @@ -409,7 +409,7 @@ var ImageWidget = MediaWidget.extend({ var $div = $(el); if (/gif|jpe|jpg|png/.test($div.data('mimetype'))) { var $img = $('', { - class: 'img img-responsive', + class: 'img-responsive', src: $div.data('url') || $div.data('src'), }); var def = $.Deferred();