我想知道,我找了几个小时后找到解决这个问题的方法。如何使用TinyMCE粘贴插件允许HTML标签?
我想在我的全能TinyMCE的编辑两种模式:
- 允许复制/粘贴HTML文本或Word/OpenOffice的文字与大多数样式和格式属性
- 粘贴插件默认启用,并删除大部分的HTML,,但允许简单的格式。
我能够复制/粘贴大多数样式的HTML文本或Word/OpenOffice文本。 默认情况下也启用粘贴插件按钮。
但是我不知道如何在插件配置糊允许一些HTML标签,特别列表(OL,UL,LI),换行符(BR)和简单的格式(B,I,U),如果粘贴插件按钮被点击。
我试着修改paste_postprocess
和paste_preprocess
函数,但是没有找到解决办法。还配置valid_elements
不会使我成功。
我的设置(重要部件):
plugins : "paste,tabfocus,table,safari",
paste_auto_cleanup_on_paste : true,
paste_create_paragraphs: false,
paste_create_linebreaks : false,
paste_postprocess : function(pl, o) { },
paste_preprocess : function(pl, o) { },
paste_remove_spans:true,
paste_remove_styles:true,
paste_remove_styles_if_webkit:true,
paste_retain_style_properties:"none",
paste_strip_class_attributes:"all",
paste_text_sticky:true,
convert_urls : false,
entity_encoding : "raw",
valid_elements : "em/i,strong/b,ol,ul,li,br",
force_br_newlines : true,
force_p_newlines : false,
forced_root_block : false,
invalid_elements : "font",
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true; // select "paste" on startup
});
},
verify_html : false
我的TinyMCE版本:3.4.9。所有在Firefox 20上使用Firefox 20的测试。 – malisokan 2013-04-22 14:21:46