summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-02-01 16:40:13 +0100
committerChristophe Simonis <chs@odoo.com>2018-02-01 16:40:13 +0100
commit920aa6174c938bbfc0864a95ff3d8ebbe3132387 (patch)
treea1bd8f8871cba6af086607d94842a4f5e53fbbbe /addons/web_editor/static/src/js
parenteeebd4ad857fec39c14abc0a0e387c13adcfa30b (diff)
parente0422bfd6c528313ee399dad3e67407360d49725 (diff)
[MERGE] forward port branch saas-15 up to e0422bfd6c5
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/backend.js12
-rw-r--r--addons/web_editor/static/src/js/summernote.js8
2 files changed, 20 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js
index 03f72253b22..ad6d2c68186 100644
--- a/addons/web_editor/static/src/js/backend.js
+++ b/addons/web_editor/static/src/js/backend.js
@@ -401,7 +401,19 @@ var FieldTextHtml = AbstractField.extend({
var layoutInfo = self.editor.rte.editable().data('layoutInfo');
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
}
+ var $ancestors = self.$iframe.filter(':not(:visible)').parentsUntil(':visible').addBack();
+ var ancestorsStyle = [];
+ // temporarily force displaying iframe (needed for firefox)
+ _.each($ancestors, function (el) {
+ var $el = $(el);
+ ancestorsStyle.unshift($el.attr('style') || null);
+ $el.css({display: 'initial', visibility: 'hidden', height: 1});
+ });
self.editor.buildingBlock.clean_for_save();
+ _.each($ancestors, function (el) {
+ var $el = $(el);
+ $el.attr('style', ancestorsStyle.pop());
+ });
self._setValue(self.$content.html());
});
},
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js
index a3e3db42a71..8166d77201e 100644
--- a/addons/web_editor/static/src/js/summernote.js
+++ b/addons/web_editor/static/src/js/summernote.js
@@ -2018,6 +2018,14 @@ eventHandler.modules.editor.currentStyle = function (target) {
if(r)
styleInfo.image = r.isOnImg();
}
+ // Fix when the target is a link: the text-align buttons state should
+ // indicate the alignment of the link in the parent, not the text inside
+ // the link (which is not possible to customize with summernote). Summernote fixed
+ // this in their newest version... by just not showing the active button
+ // for alignments.
+ if (styleInfo.anchor) {
+ styleInfo['text-align'] = $(styleInfo.anchor).parent().css('text-align');
+ }
return styleInfo;
}