Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Remove <p> tags - TinyMCE HTMLeditor

Go to End

2 Posts   4086 Views


Community Member, 18 Posts

17 February 2012 at 7:26pm

Edited: 17/02/2012 8:37pm

I'm posting the solution Ive found to successfully removing the p tags from the TinyMCE editor considering the grief it has given me, it might be useful to someone else.

I understand there are people who believe the p tags are necessary, but I much prefer <br /> tags and think they provide much for cleaner code.

There's also a css 'solution'.


But my preferred solution below.


class CustomLeftAndMainDecorator extends LeftAndMainDecorator{
   function init(){
		$htmlEditorConfig = HtmlEditorConfig::get('cms');

Add to mysite/_config.php

Object::add_extension("LeftAndMain", "CustomLeftAndMainDecorator");


Forum Moderator, 1391 Posts

18 February 2012 at 12:58am

Edited: 18/02/2012 12:59am

On windows you can do <shift><enter> to create a <br /> instead of a new <p>. giving you the best of both worlds. Works on mac too I think