diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-08-21 16:58:16 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-08-21 16:58:16 +0200 |
| commit | 668c360e32b4130966eddc8ed28b6cb4e66055aa (patch) | |
| tree | 0e50e6458998b2e4ad029341600655586eb14929 /addons/web_editor/static/src/js/editor/summernote.js | |
| parent | 121034f79a6a4e57ed936c8672fc5f8472ca2cfd (diff) | |
| parent | 1b234b1be75e32f741b3e236a89ea854f0c186a5 (diff) | |
[MERGE] forward port branch 11.0 up to 1b234b1be75
Diffstat (limited to 'addons/web_editor/static/src/js/editor/summernote.js')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/summernote.js | 8 |
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 f3d895c1b76..e67bf160e53 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -2095,14 +2095,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'); } |
