Merge pull request #504 from anandpdoshi/editor-bugfix

Use jquery to remove style attributes in clean_html in editor.js
This commit is contained in:
Anand Doshi 2014-05-07 12:30:07 +05:30
commit a35174399e

View file

@ -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(/(<br>|\s|<div><br><\/div>|&nbsp;)*$/, '');
// 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 = $("<div></div>").html(html);
// remove style attributes
tmp.find("*").removeAttr("style");
html = tmp.html();
}
return html;
},
init_file_drops: function () {