From abf113e2d43f4b5c353bf3945275f6396adf9788 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 7 May 2014 12:21:03 +0530 Subject: [PATCH] Use jquery to remove style attributes in clean_html in editor.js --- frappe/public/js/frappe/ui/editor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frappe/public/js/frappe/ui/editor.js b/frappe/public/js/frappe/ui/editor.js index 2bed8d297a..4cdeaeb3d7 100644 --- a/frappe/public/js/frappe/ui/editor.js +++ b/frappe/public/js/frappe/ui/editor.js @@ -126,15 +126,16 @@ bsEditor = Class.extend({ var html = this.editor.html() || ""; if(!$.trim(this.editor.text()) && !(this.editor.find("img"))) html = ""; - // html = html.replace(/(
|\s|

<\/div>| )*$/, ''); // remove custom typography (use CSS!) if(this.options.remove_typography) { - html = html.replace(/(font-family|font-size|line-height):[^;]*;/g, ''); - html = html.replace(/<[^>]*(font=['"][^'"]*['"])>/g, function(a,b) { return a.replace(b, ''); }); - html = html.replace(/\s*style\s*=\s*["']\s*["']/g, ''); - return html; + var tmp = $("
").html(html); + // remove style attributes + tmp.find("*").removeAttr("style"); + html = tmp.html(); } + + return html; }, init_file_drops: function () {