我正在尝试实现 tinyMCE 的 BBCode 插件,但无法使其工作。
这是初始化代码:
$(textarea).tinymce({
script_url : '/js/tiny_mce/tiny_mce.js',
theme : "advanced",
plugins : "bbcode",
theme_advanced_buttons1 : "bold,italic,underline,forecolor,|,undo,redo,link,unlink,|,removeformat,cleanup",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
entity_encoding : "raw",
remove_linebreaks : false,
forced_root_block : false,
force_br_newlines : true,
force_p_newlines : false,
convert_newlines_to_brs : true,
remove_redundant_brs : false,
width: '700px',
height: '250px'
});
问题是,当我提交表单时,会发布 HTML 标签而不是 BBCode。如果我尝试
tinyMCE.activeEditor.getContent()
在控制台上,它带来了 BBCode。我正在使用 input[type=submit] 发送表单(没有附加任何 JS)。
为什么我没有收到 BBCode 发布?
最佳答案
尝试通过 htmlentities 函数传递 textarea 内容,然后再将其发送到将处理数据的文件!
关于TinyMCE 和 BBCode 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7717965/