Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove the extra p tag in tinyMCE

Tags:

tinymce

When you copy and paste from a word document in to the tinyMCE editor sometimes there are unwanted <p> tags:

<p>&nbsp;</p>
<div class="starpasspro-example-question">
   <p><strong>Example: Levels of strategy</strong></p>
   <p>Microsoft is one of the world&rsquo;s largest organisations, providing corporate solutions to businesses throughout the world to help them realise their fullest potential. At Microsoft, there are three levels of strategy as follows:</p>
</div>
<p>&nbsp;</p>

Here the code that generates I want to remove the <p> tags any way to do that ?

like image 385
Piumal Chamath Avatar asked Jun 12 '13 06:06

Piumal Chamath


People also ask

How do I remove TinyMCE status bar?

statusbar. This option allows you to specify whether or not TinyMCE should display the status bar at the bottom of the editor. To disable the status bar, the statusbar option should be provided with a boolean false value.

How do I remove powered by TinyMCE?

You can remove this status bar with "statusbar: false".

How do you hide on TinyMCE?

if you have only one editorinstance at your page you may use tinymce. editors[0]. hide(); too.


2 Answers

Add these Lines in your tinymce.init({ });

Example:

tinymce.init({
    forced_root_block : "", 
    force_br_newlines : true,
    force_p_newlines : false,
});
like image 95
rkaartikeyan Avatar answered Sep 20 '22 19:09

rkaartikeyan


it will be helpful.

Add into your tinymce.yml file

forced_root_block : "" 

force_br_newlines : true

force_p_newlines : false
like image 39
Dsr Avatar answered Sep 22 '22 19:09

Dsr