Jump to content

WYSIWYG editor with list type text with newlines


lpa
 Share

Recommended Posts

I have a field that mainly contains text that should preserve newlines. At the moment the fields textarea is defined without CKEditor or TinyMCE, but has "Newlines to XHTML Line Breaks" text formatter. The users would like to get the possibility to colorize and emphasize text with bold, italics and colors. If I change the field to use CKEditor, all the newlines are stripped away and the text with linebreaks changes to  one paragraph with stripped away newlines.

I know the newlines can be inserted with shift-enter, but can I preserve the current texts newlines and make it possible to paste text with newlines to preserve those newlines?

How should I define this field and its WYSIWYG editor?

Link to comment
Share on other sites

Plugins for ckeditor:

http://ckeditor.com/addon/colorbutton
http://ckeditor.com/addon/magicline

Or dive into the config.js and do it yourself, here are a few examples to make you familiar:

config.allowedContent = true; // don't filter anything, i.e. allow custom style / classes / id etc.

config.enterMode = CKEDITOR.ENTER_P; // wraps everything in <p>, change it to your liking.
config.forcePasteAsPlainText = true;

Use google to find more.

Here is also a good post to read:

https://processwire.com/talk/topic/3972-ckeditor-with-attritbutes/

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...