diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-01-14 10:46:02 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-01-16 16:38:09 +0100 |
| commit | 031b83d9e7b74d465616c237494235e2ca9002a3 (patch) | |
| tree | 535e119eb2aa01e33d2b968364884ebdaa3b4176 /addons/website/static/src/js | |
| parent | 7c10c9ac27fb8af5944a74887593b011f8ea2335 (diff) | |
[FIX] website editor: images removed inside selection when change color
Diffstat (limited to 'addons/website/static/src/js')
| -rw-r--r-- | addons/website/static/src/js/summernote.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/addons/website/static/src/js/summernote.js b/addons/website/static/src/js/summernote.js index 016b9f302c5..9b929dfb2dc 100644 --- a/addons/website/static/src/js/summernote.js +++ b/addons/website/static/src/js/summernote.js @@ -699,12 +699,12 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor) return $(node).closest('[contenteditable]').is('[contenteditable="true"]'); }; - dom.isFont = function (node) { var nodeName = node && node.nodeName.toUpperCase(); return node && (nodeName === "FONT" || - (nodeName === "SPAN" && - (node.className.match(/(^|\s)(text|bg)-/i) || + (nodeName === "SPAN" && ( + node.className.match(/(^|\s)fa(\s|$)/i) || + node.className.match(/(^|\s)(text|bg)-/i) || (node.attributes.style && node.attributes.style.value.match(/(^|\s)(color|background-color):/i)))) ); }; dom.isVisibleText = function (textNode) { @@ -1828,10 +1828,10 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor) } if (color.indexOf('text-') !== -1) { - font.className = className + " " + color; + font.className = className.join(" ") + " " + color; font.style.color = "inherit"; } else { - font.className = className; + font.className = className.join(" "); font.style.color = color; } } @@ -1844,10 +1844,10 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor) } if (bgcolor.indexOf('bg-') !== -1) { - font.className = className + " " + bgcolor; + font.className = className.join(" ") + " " + bgcolor; font.style.backgroundColor = "inherit"; } else { - font.className = className; + font.className = className.join(" "); font.style.backgroundColor = bgcolor; } } @@ -1907,7 +1907,7 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor) for (var i=0; i<nodes.length; i++) { node = nodes[i]; - if (!dom.isVisibleText(node)) { + if ((dom.isText(node) || dom.isBR(node)) && !dom.isVisibleText(node)) { remove(node); nodes.splice(i,1); i--; |
