November Happy Hour will be moved to Thursday December 5th.

Remove <p></p> tags from TinyMCE

Vote:
 

Hello All,

It's a known issue. How can i remove the empty <p> tags that will be added in TINYMCE wysiwyg.

 

Thanks

Rachappa

#43969
Sep 27, 2010 21:50
Vote:
 

I assume you are referring to the <p></p> tag set that TinyMCE automatically wraps the text in?
They are activated by default for a reason - see discussion here: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=3878

However, if you still need to remove them for special reasons, you can remove them in code, in the OnLoad override method of your page:

protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        myEditor.InitOptions["force_p_newlines"] = "false";
    }

Or in your markup:

<script>
            tinyMCE.init({

                force_p_newlines: false
});
</script>

See http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/TinyMCE-Developers-Guide/#UsingWebControl   and    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration    for details.

 

#44786
Oct 14, 2010 23:31
Vote:
 

I'm working with EPiServer 7 MVC and I'm trying to get the editor to stop putting in the p tags. But when trying 

<script>
            tinyMCE.init({
                force_p_newlines: false
});
</script> 

the tinyMCE is undefined. Does anyone know what I am doing wrong?

Many Thanks

#87476
Jun 13, 2014 14:49
Vote:
 
#87477
Jun 13, 2014 14:49
Vote:
 

Got it by using an empty class with the configuration set as an attribute see here

http://stackoverflow.com/questions/11390552/allow-custom-html-attributes-in-tinymce-in-episerver

Also you need to name the plugin in the attribute and add the folder to the tinymce part of themodules folder e.g.

PluginName in attribute 'ConfigTest'

So add the configtest folder here

[App_Data]\Modules\CMS\Util\Editor\tinymce\plugins\ConfigTest

Under this folder add in a blank editor_plugin.js file

#87598
Jun 17, 2014 17:46
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.