Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Remove <p> tags - TinyMCE HTMLeditor

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

Page: 1
Go to End
Author Topic: 2717 Views
  • Rossel
    Community Member
    18 Posts

    Remove <p> tags - TinyMCE HTMLeditor Link to this post

    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");

  • martimiz
    Forum Moderator
    1086 Posts

    Re: Remove <p> tags - TinyMCE HTMLeditor Link to this post

    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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.