From 7c959e3fd55d8faab1c0a9ea0e32fc0fdb975165 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 26 Jan 2018 14:29:27 +0100 Subject: [FIX] web_editor: properly show link alignment in toolbar When clicking on a link in the editor, the "center" alignment button was always marked as active whatever the real alignment of the link. This was because it considered the alignment of the text inside the link instead of the link's one inside its parent. --- addons/web_editor/static/src/js/summernote.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'addons/web_editor/static/src/js') diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index cdf4329c0b9..da837d67354 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -2015,6 +2015,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; } -- cgit v1.2.3