我正在尝试对其进行设置,以便当我粘贴文本时,特别是来自 Word 或其他来源的文本,所有样式都将被剥离。我很高兴让粗体和斜体样式以及列表等保持不变,但其余的应该消失。
我怎样才能做到这一点?
我知道有一个插件可以让我通过单击按钮进行粘贴,但我正在寻找是否有人按下 CTRL+V 或 command+V。
有什么帮助吗?
我正在尝试对其进行设置,以便当我粘贴文本时,特别是来自 Word 或其他来源的文本,所有样式都将被剥离。我很高兴让粗体和斜体样式以及列表等保持不变,但其余的应该消失。
我怎样才能做到这一点?
我知道有一个插件可以让我通过单击按钮进行粘贴,但我正在寻找是否有人按下 CTRL+V 或 command+V。
有什么帮助吗?
我正在使用带有粘贴插件的 TinyMCE 和以下设置:
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",
它就是这样做的:当您点击“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;
尝试不加载粘贴扩展。