diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index c2cf0d68d6c..3d2c4c205d4 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -2237,7 +2237,7 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color // select nodes to clean (to remove empty font and merge same nodes) nodes = []; dom.walkPoint(startPoint, endPoint, function (point) { - nodes.push(point.node); + nodes.push(point.node.childNodes[point.offset] || point.node); }); nodes = list.unique(nodes); @@ -2256,10 +2256,8 @@ $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color for (i=0; i0 && (font = dom.ancestor(nodes[i-1], dom.isFont))) { + if (font = dom.ancestor(node.previousSibling, dom.isFont)) { className2 = font.getAttribute('class'); style2 = font.getAttribute('style'); if (node !== font && className === className2 && style === style2) { remove(node, font); - nodes.splice(i,1); - i--; continue; } }