tinymce删除文本空格和换行符

我已经像这样初始化了tinyMCE:

$('#description').tinymce({ // Location of TinyMCE script script_url : 'tinymce/jscripts/tiny_mce/tiny_mce.js', // General options width : "830", height: "300", theme : "advanced", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_toolbar_location : "top", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", force_br_newlines : true, force_p_newlines : false, gecko_spellcheck : true, forced_root_block : '', // Needed for 3.x plugins : "paste" }); 

我有一些texttarea文本。当我运行它,它删除所有空格和换行符,并在一行显示文本这里是我的文本

“全新的!!!

巨大的三卧室公寓位于迪拜docker奥拉塔出租

位于高层,俯瞰docker的美景

您可以通过添加另一个参数remove_linebreaks来管理它

 $('#description').tinymce({ // Location of TinyMCE script script_url : 'tinymce/jscripts/tiny_mce/tiny_mce.js', // General options width : "830", height: "300", theme : "advanced", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_toolbar_location : "top", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", force_br_newlines : true, force_p_newlines : false, gecko_spellcheck : true, forced_root_block : '', // Needed for 3.x remove_linebreaks : false, plugins : "paste"}); 

但这取决于您使用的tinyMCE版本。 因为在下面的网站中他们说该属性在某些版本中不可用。 http://www.tinymce.com/wiki.php/Configuration3x:remove_linebreaks

如果有人在未来遇到这种情况,我们就会遇到有关线路故障被剥夺的问题,并尝试了我们能找到的每一个建议,没有运气。

我在这里遇到了这个解决方案: http : //community.tinymce.com/forum/viewtopic.php?id = 5636 ,它完美地完成了这个技巧。

添加以下两行tinyMCE.init()函数,默认情况下它们似乎设置为false。

 force_p_newlines : true, force_br_newlines : true