本文介绍了tinymce删除文本空间和换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have initialised tinyMCE like so:

        $('#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"


    });

我有一些文本区域,当我运行它时,它会删除所有空格和换行符,并在一行中显示文本这是我的文字

i have textarea with some text.when i run it,it removes all spaces and line breaks and display text in one linehere is my text

全新!!!

位于迪拜Marina Orra塔出租的三居室公寓的巨大面积

Huge size of 3 bedroom apartment located in Dubai Marina Orra tower for rent

位于较高楼层,可俯瞰码头的壮丽景色"

Situated on high floor, overlooking a gorgeous view of Marina"

推荐答案

您可以通过添加另一个参数remove_linebreaks

You can manage it by adding another argument 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

But this depend on the tinyMCE version you are using. Because in the below site they say the attribute is not available in some version.http://www.tinymce.com/wiki.php/Configuration3x:remove_linebreaks

这篇关于tinymce删除文本空间和换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 22:24