Wygwam automatically adds some extra space in <p> tags by default. Is there any way to remove them without editing the source in Wygwam? I'm using Wygwam 2.6.3.

What is intended

<p>This is a paragraph</p>

What actually happens

     This is a paragraph</p>

The themes/third_party/wygwam/lib/ckeditor/config.js file actually comes with the code necessary to do this – you just need to uncomment it. Have you tried that?

  • duh, it was staring me right in the face!
    – Dan
    Jan 11 '13 at 15:52

You'll need to override the default CKEditor rules for processing P tags.

Add this:

this.dataProcessor.writer.setRules( 'p',
                    indent : false,
                    breakBeforeOpen : true,
                    breakAfterOpen : false,
                    breakBeforeClose : false,
                    breakAfterClose : true

to your: themes/third_party/wygwam/lib/ckeditor/config.js file.

More info here: http://ckeditor.com/forums/Support/BUG-CKeditor-adds-new-line-and-tab-space-after-P-tag

  • hmm, I added that and it makes sense why, but it didn't seem to work.
    – Dan
    Jan 10 '13 at 18:25
  • Did you add it inside the instanceReady function?
    – Brad Bell
    Jan 10 '13 at 18:34
  • Yep, this is what that config file looks like jsfiddle.net/CSHZD
    – Dan
    Jan 10 '13 at 18:38
  • Try clearing your browser's cache?
    – Brad Bell
    Jan 10 '13 at 18:58
  • nope :( still no luck
    – Dan
    Jan 10 '13 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.