summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-08-21 15:19:38 +0200
committerChristophe Simonis <chs@odoo.com>2019-08-21 15:19:38 +0200
commit77dca40215389d0c2a944def5f79cc4ac47f4744 (patch)
tree6dd30fbacef92fcfaa6a8a6f49d234e454454ca1 /addons/web_editor/static/src/js
parent67d82b875cddba7bf28c3f4eba295df31dce3d48 (diff)
parentd8524aadf810756f5ff3d1625fdbd8a74ac0ce57 (diff)
[MERGE] forward port branch saas-15 up to d8524aadf81
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/editor/summernote.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js
index cf7b370b0fa..bdf0f2f688e 100644
--- a/addons/web_editor/static/src/js/editor/summernote.js
+++ b/addons/web_editor/static/src/js/editor/summernote.js
@@ -2108,14 +2108,16 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color
}
// apply font: foreColor, backColor, size (the color can be use a class text-... or bg-...)
- var font, $font, fonts = [], className;
+ var ancestors, font, $font, fonts = [], className;
var i;
if (color || bgcolor || size) {
for (i=0; i<nodes.length; i++) {
node = nodes[i];
- font = dom.ancestor(node, dom.isFont);
- if (!font) {
+ ancestors = dom.listAncestor(node, dom.isFont);
+ font = ancestors.slice(-1)[0];
+ // add font if node is not inside a font or inside an anchor firstly
+ if (!dom.isFont(font) || ancestors.filter(dom.isAnchor).length) {
if (node.textContent.match(/^[ ]|[ ]$/)) {
node.textContent = node.textContent.replace(/^[ ]|[ ]$/g, '\u00A0');
}