summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-01-26 14:29:27 +0100
committerqsm-odoo <qsm@odoo.com>2018-01-26 16:17:19 +0100
commit7c959e3fd55d8faab1c0a9ea0e32fc0fdb975165 (patch)
tree1485d32a86e10e6a0f3da33660d4aa1971492215 /addons/web_editor/static
parentea879956b16e49a4f25832a94242d7563b67aace (diff)
[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.
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/summernote.js8
1 files changed, 8 insertions, 0 deletions
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;
}