From 031b83d9e7b74d465616c237494235e2ca9002a3 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 14 Jan 2015 10:46:02 +0100 Subject: [PATCH] [FIX] website editor: images removed inside selection when change color --- addons/website/static/src/js/summernote.js | 16 ++++++++-------- 1 file 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