Import xinha so we can switch from htmlarea and fix a bunch of in-browser issues that htmlarea has

This commit is contained in:
Chris Morgan
2005-09-30 02:25:07 +00:00
committed by WineHQ
parent 2311d4d572
commit 9242a68c4a
375 changed files with 26623 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
// Unormat plugin for HTMLArea
function UnFormat(editor) {
this.editor = editor;
var cfg = editor.config;
var self = this;
cfg.registerButton({
id : "unformat",
tooltip : this._lc("Page Cleaner"),
image : editor.imgURL("unformat.gif", "UnFormat"),
textMode : false,
action : function(editor) {
self.buttonPress(editor);
}
})
cfg.addToolbarElement("unformat", "killword", 1);
};
UnFormat._pluginInfo = {
name : "UnFormat",
version : "1.0",
license : "htmlArea"
};
UnFormat.prototype._lc = function(string) {
return HTMLArea._lc(string, 'UnFormat');
}
UnFormat.prototype.buttonPress = function(editor){
editor._popupDialog( "plugin://UnFormat/unformat", function( param){
if (param) {
if (param["cleaning_area"] == "all") {
var html = editor._doc.body.innerHTML;
} else {
var html = editor.getSelectedHTML();
}
if (param["html_all"]== true) {
html = html.replace(/<[\!]*?[^<>]*?>/g, "");
}
if (param["formatting"] == true) {
html = html.replace(/style="[^"]*"/gi, "");
html = html.replace(/<\/?font[^>]*>/gi,"");
html = html.replace(/<\/?b>/gi,"");
html = html.replace(/<\/?strong[^>]*>/gi,"");
html = html.replace(/<\/?i>/gi,"");
html = html.replace(/<\/?em[^>]*>/gi,"");
html = html.replace(/<\/?u[^>]*>/gi,"");
html = html.replace(/<\/?strike[^>]*>/gi,"");
html = html.replace(/ align=[^\s|>]*/gi,"");
html = html.replace(/ class=[^\s|>]*/gi,"");
}
if (param["cleaning_area"] == "all") {
editor._doc.body.innerHTML = html;
} else {
editor.insertHTML(html);
}
} else { return false; }
}, null);
}