【问题标题】:convert p to br on tinyMCE在 tinyMCE 上将 p 转换为 br
【发布时间】:2011-09-05 18:26:56
【问题描述】:

请帮忙。我使用 tinyMCE 作为内联编辑器。所以我需要当用户在编辑模式下按回车键时将是<br /> 而不是<p>。我阅读手册和常见问题解答并尝试

tinyMCE.init({
            'height' : '100%',
            'widht':'100%',
            'content_css' : styles + ',/sdtc-new/nc/interface/common/css/mce-editor.css',
            'mode' : "specific_textareas",
            'editor_selector' : prefix + o.id,
            'theme':'advanced',
        theme_advanced_buttons1: o.buttons.join(','),
        theme_advanced_buttons2 : "",
        **theme_advanced_buttons3 : "",
    force_br_newlines : true,
        force_p_newlines : false,
        forced_root_block : '' // Needed for 3.x**
        });

但这行不通。实际上,有时它就像我删除编辑区域中的所有内容并键入新文本一样。但我需要它一直有效。请帮忙。 tinyMCE 3.4.4 版本

【问题讨论】:

    标签: javascript tinymce inline-editing


    【解决方案1】:

    你需要设置

    tinyMCE.init({
       forced_root_block : false,
       force_br_newlines : true,
       force_p_newlines : false
       ...
    });
    

    tinymce 常见问题的Here is a helpfull section

    【讨论】:

    • 你的意思是我使用的顺序不对?因为我使用这个指令,但以其他顺序。
    • 顺序无所谓,但''不等于false!
    • console.log('' == false); //真
    • 我尝试使用 FireFox 6.1 和 TinyMCE 3.4.4
    • 是的,你是对的,我在 tinyMCE 的代码中看到了这个设置确实正确只适用于 IE,但 Shift+Enter 在 FF 和 IE 和 Google Chrome 中正常工作。当然我可以重新绑定按键事件,但我认为这很愚蠢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 2011-12-05
    • 2011-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多