summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-02-01 14:16:50 +0100
committerChristophe Simonis <chs@odoo.com>2018-02-01 14:16:50 +0100
commit7d465aa56cf421d009b25a41fc226f82de7c2192 (patch)
tree6838248a00d58299b31fee243109ceada8ec0b77 /addons/web_editor/static/src
parent5b230c34cb960f3f729d6612735dd9c3c896b785 (diff)
parent4c9bf7faae4e5e53955fde1e69ef82e72dd51ccb (diff)
[MERGE] forward port branch 10.0 up to 4c9bf7faae4
Diffstat (limited to 'addons/web_editor/static/src')
-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 f4f8d7144b6..23505c082fa 100644
--- a/addons/web_editor/static/src/js/backend.js
+++ b/addons/web_editor/static/src/js/backend.js
@@ -405,7 +405,19 @@ var FieldTextHtml = widget.extend({
var layoutInfo = this.editor.rte.editable().data('layoutInfo');
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
}
+ var $ancestors = this.$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});
+ });
this.editor.buildingBlock.clean_for_save();
+ _.each($ancestors, function (el) {
+ var $el = $(el);
+ $el.attr('style', ancestorsStyle.pop());
+ });
this.internal_set_value( this.$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;
}