diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-09-28 14:08:00 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-09-28 15:23:35 +0200 |
| commit | d459359e87921619028d856a50c462288c0abe9d (patch) | |
| tree | 63aae5eb30c1f740abba0361bd5b1d338ec0b2dc /addons/web_editor/static/src/js/transcoder.js | |
| parent | bdf58adb465b2016d0d288cdcdec592e4151061d (diff) | |
[IMP] web_editor: Convert font-awsome into picture before convert class into style to remove unnecessary style attributes
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
| -rw-r--r-- | addons/web_editor/static/src/js/transcoder.js | 4 |
1 files changed, 3 insertions, 1 deletions
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 = $("<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", "") |
