Hey guys,
Recently we've upgraded our admin panel from FCKEditor 2.x to CKEditor and we're extremely pleased with the results, however, there's a minor "snag" that we can't seem to get around
With FCK, we had the enter mode set for <p> tags, and every time we would paste a block of text in which the lines were separated by a full break, using "Paste as Plain Text", the output would have been like this (when using View Source):
From
Text 1
Text 2
to:
<p>Text 1</p>
<p>Text 2</p>
Which is exactly what we needed.
Unfortunately, with CKEditor, even if we've defined config.enterMode = CKEDITOR.ENTER_P; in the config.js file, the output for the above block of text is always this:
<p>Text 1<br />
Text 2</p>
Which is a very annoying problem and artificially increases the time spent by our editors properly formatting the text.
Is there any way to "convince" CKEditor to treat each separate line as a different paragraph and not insert a simple br between them when using Paste as plain text
Re: CKEditor - Paste as text p tags for breaks instead of br
Re: CKEditor - Paste as text p tags for breaks instead of br
Well, we didn't manage to find any solution, so we had to downgrade to FCK 2.6.5
Re: CKEditor - Paste as text p tags for breaks instead of br
I am using a paid plugin for ExpressionEngine, I guess I can switch to something free but what a waste.
Re: CKEditor - Paste as text p tags for breaks instead of br
Sorry for the late reply but we will work this feature, make it functional as v2, even better:
http://dev.fckeditor.net/ticket/4508
You're probably have it with version 3.1.
Re: CKEditor - Paste as text p tags for breaks instead of br
Open ckeditor.js with your favorite javascript editor. Search for
and replace it with
I can't downgrade to v2 just to get rid of that bug. By changing the code, there's no need for me to wait for version 3.1. I don't even know if my hack is valid; all I know is it works. I am not sure if there's no side effect (I didn't run the test suite). So if anyone, has a better work around, please post here. I desperately need this bug fixed ASAP.
Re: CKEditor - Paste as text p tags for breaks instead of br
Hi.

Can you release a patch to fix this? I know that version 3.1 has many enhancements including the fix for this bug. Those 3.1 enhancements is a big change that I can wait, but I can't wait for the fix for this particular bug. I hacked version 3.0 to fix this but I'm worried of the side effects. It's better if the core developers who know CKEditor internals release a patched version. Thank you very much.
PS: Having an article full of "<br/><br/>" is not acceptable by the CMS we use. And we became an enemy of W3C because of that "<br/><br/>" everywhere.
Re: CKEditor - Paste as text p tags for breaks instead of br
Re: CKEditor - Paste as text p tags for breaks instead of br
I'm sorry but we can't release patches at will, we'll have a minor bug fixing release every 1.5 month before 3.1 is born, so we'll probably fix that even before 3.1. I can confirm the hack you have there have no side effects ( don't break other functionality ), so it probably could be the work around for you now.
Re: CKEditor - Paste as text p tags for breaks instead of br
I use it with hotkey SHIFT-V with IE8 to be able to paste quicker without dialogs or even click a button. For that in config. js i have:
I just made it so i have not tested it continiously. This paste don't allow empty <p> tags. So if you have
text1
[newline]
[newline]
text2
will become like there was one newline
<p>text1</p>
<p>text2</p>
Attachments:
Re: CKEditor - Paste as text p tags for breaks instead of br
This's already working in current version (Two line-breaks map to one <p>, one maps to <br />), while the plugin @noefekts provide the mapping from each line-break to one paragraph.
Re: CKEditor - Paste as text p tags for breaks instead of br
I need the editor to create a paragraph for each line, instead of using <br/>... If a text with paragraphs is copy-pasted, they are set correctly, but I need the conversion every time, also when copying regular unformatted text.
How?
Thanks
~Aki
Re: CKEditor - Paste as text p tags for breaks instead of br
I looked through the changelog and I couldn't find ticket #4508
I'm using ckeditor v3.4.1 and when I paste from plain text it still uses <br/> instead of closing the paragraph </p> and starting a new one <p>
Is there something I need to set in the config file or has this change not been made?
Cheers
Tom
Re: CKEditor - Paste as text p tags for breaks instead of br
Hi,
I'm using 3.5.3 and CKEditor still pastes text with BRs, while I need Ps instead of them.
I have CKEditor installed as Drupal 6 module.
Example text I posted here, take Raw part.
http://pastebin.com/ryjc4axu
I tried pasting using Ctrl-V, Ctrl-Shift-V, using 3 different pasting dialogs from the toolbar - nothing helps, I got this hated BRs:
Any ideas?
Re: CKEditor - Paste as text p tags for breaks instead of br
I banged my head against the wall and tried all the config options possible but couldn't get this to work. I finally setup the following, which works perfectly for me. It basically just replaces the <br> tags with <p> tags (closing it first like </p><p> does not work even though that seemed to make more sense) after ckeditor has done all it's processing on the pasted data. For whatever reason e.data.text and e.data.html (that other posts pointed to) were always undefined for me but .dataValue worked.
CKEDITOR.replace('editor', {
on: {
paste: function(e) {
if (e.data.dataValue !== 'undefined')
e.data.dataValue = e.data.dataValue.replace(/(\<br ?\/?\>)+/gi, '<p>');
}
}
}