0

Problem

When you paste text into ckeditor it creates line breaks in the display which don't appear in the actual text.

How can I either paste in text and have it create actual linebreaks, or paste in text and not show the fake linebreaks?

Example

enter image description here

In order to create an actual line break you have to press delete and then add two returns in order to create a genuine linebreak (I have CKEditor configured to create <br> on enter).

enter image description here

Sample Text I Used: Taken from Dolor Ipsum Website

(Shown in HTML Full Text format)

 <p>bibendum feugiat tortor a imperdiet. Ut nisl lorem, bibendum iaculis est quis,    mollis convallis neque. Vestibulum vitae erat vitae sem tempus consequat.</p><p>Integer a auctor lorem, sit amet sagittis lectus. Sed bibendum at purus eu mollis. Sed pretium tincidunt nulla vitae fringilla. Etiam ac fringilla nulla. Cras lectus magna, suscipit sed felis accumsan, sagittis lobortis justo. Vestibulum volutpat auctor mi, at&nbsp;</p>
  • Can you post a sample of the text that this happens for please? It's not something I've come across before, I'd suspect it's due to the formatting of the original text. If you paste your text into the question here, it will remove any formatting, and that will make it easy for anyone here to test it in their own copy of CKeditor – Clive Nov 7 '13 at 14:30
  • All done. I tend to just use sample text from lipsum.com. – Dominic Woodman Nov 7 '13 at 14:49
  • Ah ok so it's definitely down to your formatting then - when you copy the text from lipsum.com it contains absolutely no HTML tags. If you stop adding the HTML tags in, and just straight copy-paste the text (not from a word doc or similar, as that contains special formatting too), then CKeditor will behave as you're expecting it to. I've just tried it myself, when I copied the first two paragraphs from lipsum.com they get correctly formatted in the WYSIWYG – Clive Nov 7 '13 at 14:52
  • @Clive. Don't suppose you have any how it's being generated? I have convert line breaks to HTML turned off, and custom formatting in CKEditor set to yes with everything unselected. I enabled force pasting as plain text, but none of these have had any effect. – Dominic Woodman Nov 7 '13 at 17:46
0

If you're experiencing weird behavior on the editing side of CKEditor it's probably because of the CSS file being loaded by CKEditor.

CKEditor implements this in a way where it doesn't show up in my firebug.

I can see the margins and padding when I hover on an element however nothing is shown when it lists the styles effecting the element. This causes the problem above.

How to fix it:

Changing the CSS file works, go to the CKEditor configuration page and select the CSS drop down menu.

Change CKEditor default to Define CSS and enter your own path for the CSS file.

What I did however was edit the CKEditor default css file. It's located in ../modules/ckeditor/ckeditor/contents.css

I was getting a margin of 20px appearing on the top and bottom of all my elements. There was nothing in contents.css about it, I don't really know where it's coming from.

But I added the following snippet which fixed it.

p,
h1,
h2,
h3,
ul li {

margin: 0 auto;

}
| improve this answer | |

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.