简体   繁体   中英

How to remove the P tag from TinyMCE

I work with TinyMCE and it surrounds my text with a <p> tag.

I tried using this: forced_root_block : "" following this: How can I remove p tags that are auto added within tinymce

and this isn't working for me :X

I saw this post too: remove the extra p tag in tinyMCE

and added:

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

and this isn't helping.

This is my current code part:

<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>

you need to add the following line to your init statement

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>

if this not work than try change in "tiny_mce.js" and not in "tiny_mce_src.js"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM