如何从 TinyMCE 中删除 P 标签

How to remove the P tag from TinyMCE

我使用 TinyMCE,它用 <p> 标签包围我的文本。

我尝试使用这个:forced_root_block : "" 之后:How can I remove p tags that are auto added within tinymce

这对我不起作用:X

我也看到了这个post: remove the extra p tag in tinyMCE

并添加:

forced_root_block : "", 
force_br_newlines : true,
force_p_newlines : false

这没有帮助。

这是我当前的代码部分:

<script type="text/javascript">
    tinymce.init({
        selector: ".mytextarea", 
        plugins: "paste",
        paste_auto_cleanup_on_paste : true,
        paste_remove_styles: true,
        paste_remove_styles_if_webkit: true,
        paste_strip_class_attributes: "all", 
        forced_root_block : "", 
        force_br_newlines : true, // tried with and without
        force_p_newlines : false // tried with and without
        //paste_remove_spans : true
    });
</script>

您需要将以下行添加到您的 init 语句

forced_root_block :false


<script type="text/javascript">
    tinymce.init({
        selector: ".mytextarea", 
        plugins: "paste",
        paste_auto_cleanup_on_paste : true,
        paste_remove_styles: true,
        paste_remove_styles_if_webkit: true,
        paste_strip_class_attributes: "all", 
        forced_root_block : false, 
        force_br_newlines : true, // tried with and without
        force_p_newlines : false // tried with and without
        //paste_remove_spans : true
    });
</script>

如果这行不通,请尝试更改 "tiny_mce.js" 而不是 "tiny_mce_src.js"