Jump to content

CKeditor strips <br> tags from input


Neo
 Share

Recommended Posts

I am trying to allow <br> tags (line breaks) in the input field of the CKeditor, which are currently stripped.

The field does not use a text formatter, the content type is set to "Markup/HTML" and ACF and HTML Purifier have been switched off.

I have also added "br" to the extra allowed content. 

It is still removed. Any idea how to get this working?

 

 

Link to comment
Share on other sites

Strange that it isn't working for you. Line breaks work fine in CKEditor for me, even with ACF and HTML Purifier on and without having to add "br" to Extra Allowed Content. Can you test on another PW installation to see if line breaks are working there?

Also, are you entering line breaks in CKEditor using Shift+Enter or are you pasting in source code?

  • Like 2
Link to comment
Share on other sites

I tried both methods, adding "br" tags via the source code and also using Shift+Enter. It is always removed on "Save".

I also tried <br /> and <br/>; same result.

When I unselect "Remove non-breaking spaces (nbsp)" for the field and I add a line break wrapped in paragraph (which is quiet ugly), the <br> is transformed into nbsp. This creates a space with a new line, but is not really the intended outcome: <p>&nbsp;</p>

I also tried to explicitly allow br tags in config-body.js without success:

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.uiColor = '#AADC6E';
  config.autoParagraph = false;
  config.AllowedContent = 'br[clear]';
};

Not sure if this is an issue with the CKEDitor plugin.

Also tried the "Newlines to XHTML Line Breaks" but that creates a mess with a <br /> for every new line, which is the idea of the module, but does not give you much control.

The site is running on Processwire 3.x version, which is currently my only installation on localhost, so I have not been able to verify this behavior yet in other or "clean" installations.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...