[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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user