我有一个tinymce表单,并且在大多数情况下都可以使用,但是当我从Internet或文字处理器中复制某些内容并尝试将其粘贴时,内联样式将保持不变。

我已经尝试通过几种方法解决此问题,但是没有运气。好像这个样式标签困扰着我!

我将完全删除样式标签,并且我确实尝试过,但是当我这样做时,您可以在tinymce中添加的样式(例如,文本对齐)无效了,我真的不想这样做。

这就是我目前所拥有的,您可以看到我正在尝试删除粘贴上的样式,但是它不起作用。一些帮助将不胜感激!

tinyMCE.init({
mode : "exact",
elements : "wStory",
plugins : "paste",
theme: "advanced",
width: "80em",
height: "700px",
paste_auto_cleanup_on_paste : true,
paste_remove_styles: true,
paste_remove_styles_if_webkit: true,
paste_strip_class_attributes: true,
theme_advanced_buttons1:"bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,justifyfull,outdent, indent,|,cleanup,|,forecolor, |,undo,redo,|,link, unlink",
theme_advanced_toolbar_location:"top",
theme_advanced_toolbar_align:"center",
theme_advanced_resizing:false,
width:"100%",height:"700px",
invalid_elements: "span, div",
theme_advanced_path:false,
setup : function(ed) {
    ed.onInit.add(function(ed) {
    ed.pasteAsPlainText = true;
});
},


});

最佳答案

出于某种奇怪的原因,在最新的tinymce中我什么都没做。我希望这可以帮助遇到这个问题的其他人

  cleanup_on_startup : true,
  fix_list_elements : false,
  fix_nesting : false,
  fix_table_elements : false,
  paste_use_dialog : true,
  paste_auto_cleanup_on_paste : true,


我必须将这些粘贴到init函数中。这允许它发布纯文本,然后当用户放置居中位置等样式时,在指定文本周围添加一个段落标签

09-30 13:47
查看更多