Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

javascript - How can I remove p tags that are auto added within tinymce

I am using tinymce 4.0.1 and it automatically adds p tags when you either start typing or hit enter. How can I dynamically remove these p tags and then reinsert the content into the editor.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you need to add the following line to your init statement

forced_root_block : ""

So, your complete code will be like this:

    <script>tinymce.init({forced_root_block : "",selector:'textarea'});</script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...