summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
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');
}