diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-05-24 13:57:47 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-05-25 17:58:54 +0200 |
| commit | 38ac59871ec529092ed4cabc58007d7ec45496ed (patch) | |
| tree | f952536cea0bd711c23a653c5516a89c9d7c8765 | |
| parent | 58e35522468d1d4c0674518f785a32be56d2c1a2 (diff) | |
[FIX] portal, web_editor: keep BS 'img-responsive' *opt-in*
Bootstrap 'img-responsive' behavior was opt-in for a reason but commit
https://github.com/odoo/odoo/commit/f79b00c3b71e02f73537cb17285a6902fc0906b5
tried to defy that anyway. This would break existing client databases
... or at least our odoo.com.
This commit adds the img-responsive class for *new* *editor* images
(still with inline-block display), preventing breaking libraries or
custom (prod) images.
| -rw-r--r-- | addons/portal/static/src/less/portal.less | 7 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/widgets/widgets.js | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/addons/portal/static/src/less/portal.less b/addons/portal/static/src/less/portal.less index 0e34d305fb5..9b62e37121b 100644 --- a/addons/portal/static/src/less/portal.less +++ b/addons/portal/static/src/less/portal.less @@ -152,9 +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); +img.o_we_custom_image { + // Images added with the editor are .img-responsive by default but should + // still behave like inline content. + display: inline-block; } // Others diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index b63568ff0bd..51ff585d200 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -308,7 +308,10 @@ var ImageWidget = MediaWidget.extend({ img.src += _.str.sprintf('?access_token=%s', img.access_token); } if (!self.$media.is('img')) { - self._replaceMedia($('<img/>')); + // Note: by default the images receive the bootstrap opt-in + // img-responsive class. We cannot make them all responsive + // by design because of libraries and client databases img. + self._replaceMedia($('<img/>', {class: 'img-responsive o_we_custom_image'})); } self.$media.attr('src', img.src); |
