1
如果有人抓起东西掉一个网页或电子邮件,不会捕捉一切,然后粘贴到这一点与缺少的标记(如<p>
和<div>
)TinyMCE的,你怎么防止那些未关闭标签蔓延到你的页面的其余部分?谢谢!TInyMCE - 防止粘贴破碎的HTML?
如果有人抓起东西掉一个网页或电子邮件,不会捕捉一切,然后粘贴到这一点与缺少的标记(如<p>
和<div>
)TinyMCE的,你怎么防止那些未关闭标签蔓延到你的页面的其余部分?谢谢!TInyMCE - 防止粘贴破碎的HTML?
查找到实施Tiny MCE Paste plugin,它有一个选项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 :-";
}
});