4 javascript coding-style tinymce
我正在尝试将其设置为当我粘贴文本时,特别是从Word或其他来源,所有样式都将被剥离.我很高兴让大胆和斜体的样式和列表等一样,但其余的应该去.
我怎样才能做到这一点?
我知道有一个插件可以让我这样做,如果我通过单击按钮粘贴,但我正在寻找是否有人按CTRL + V或命令+ V.
有帮助吗?
我正在使用TinyMCE和paste插件进行以下设置:
paste_create_paragraphs : false,
paste_create_linebreaks : false,
paste_use_dialog : true,
paste_auto_cleanup_on_paste : true,
paste_convert_middot_lists : false,
paste_unindented_list_class : "unindentedList",
paste_convert_headers_to_strong : true,
paste_insert_word_content_callback : "convertWord",
Run Code Online (Sandbox Code Playgroud)
它就是这样:当你点击"Ctrl-V"时,会弹出一个对话框,让你粘贴你的内容,这些内容可以从任何与Word相关的东西中自动清除.
您可能还需要此无操作回调:
function convertWord(type, content) {
switch (type) {
// Gets executed before the built in logic performes it's cleanups
case "before":
//content = content.toLowerCase(); // Some dummy logic
break;
// Gets executed after the built in logic performes it's cleanups
case "after":
//content = content.toLowerCase(); // Some dummy logic
break;
}
return content;
Run Code Online (Sandbox Code Playgroud)