From d459359e87921619028d856a50c462288c0abe9d Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 28 Sep 2015 14:08:00 +0200 Subject: [IMP] web_editor: Convert font-awsome into picture before convert class into style to remove unnecessary style attributes --- addons/web_editor/static/src/js/transcoder.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web_editor/static/src/js/transcoder.js') diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js index 583dcf9a8d6..bd7848d2e97 100644 --- a/addons/web_editor/static/src/js/transcoder.js +++ b/addons/web_editor/static/src/js/transcoder.js @@ -95,10 +95,11 @@ var getMatchedCSSRules = function (a) { var font_to_img = function ($editable) { $(".fa", $editable).each(function () { var $font = $(this); - var content; + var icon, content; _.find(widget.fontIcons, function (font) { return _.find(widget.getCssSelectors(font.parser), function (css) { if ($font.is(css[0].replace(/::?before$/, ''))) { + icon = css[2].split("-").shift(); content = css[1].match(/content:\s*['"]?(.)['"]?/)[1]; return true; } @@ -109,6 +110,7 @@ var font_to_img = function ($editable) { var src = _.str.sprintf('/web_editor/font_to_img/%s/%s/'+$font.height(), window.encodeURI(content), window.encodeURI(color)); var $img = $("").attr("src", src) .attr("data-class", $font.attr("class")) + .attr("class", $font.attr("class").replace(new RegExp("(^|\\s+)" + icon + "(-[^\\s]+)?", "gi"), '')) // remove inline font-awsome style .attr("style", $font.attr("style")) .attr("height", $font.height()) .css("height", "") -- cgit v1.2.3