Посмотрите на реализацию плагина Tiny MCE Paste , у него есть опция paste_auto_cleanup_on_paste
, которую можно установить в значение true, чтобы привести в порядок любой HTML-код после его вставки.
Из связанного примера:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "paste",
theme_advanced_buttons3_add : "pastetext,pasteword,selectall",
paste_auto_cleanup_on_paste : true,
paste_preprocess : function(pl, o) {
// Content string containing the HTML from the clipboard
alert(o.content);
o.content = "-: CLEANED :-\n" + o.content;
},
paste_postprocess : function(pl, o) {
// Content DOM node containing the DOM structure of the clipboard
alert(o.node.innerHTML);
o.node.innerHTML = o.node.innerHTML + "\n-: CLEANED :-";
}
});