Problem/Motivation
During the usability sessions, all participants were required to copy and paste from word, which is a pretty common use case. It created empty paragraphs in CKeditor. Many participants switched to source view to clear this up.
Proposed resolution
A quick google seems to give hope that this is a simple fix http://www.nodenerd.com/prevent-ckeditor-creating-empty-paragraphs-upon-...
Remaining tasks
Implement the config change
Test
User interface changes
No empty paragraphs in content! Whoop.
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ckeditor-copy-paste.png | 472.19 KB | merilainen |
| #3 | empty-paragraph-after.png | 673.21 KB | merilainen |
| #3 | empty-paragraph-before.png | 420.6 KB | merilainen |
| #2 | remove_white_space_on_paste-2516932-2.patch | 1.11 KB | merilainen |
Comments
Comment #1
merilainen commentedThe autoParagraph config mentioned in the linked blog post seems to be deprecated
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoParagraph
Comment #2
merilainen commentedI found some working javascript to fix this issue here http://stackoverflow.com/questions/17447274/ckeditor-4-removing-nbsp-and...
I added one more removal when pasting from LibreOffice and another for Pages, maybe somebody could test the Word removal on a PC with Word, since I'm on Mac OS X and I don't have Word installed.
Also I'm not sure if the code is properly formatted, not very experienced javascript writer, especially not sure if this is done in a correct Drupal way.
Comment #3
merilainen commentedUploaded before and after screenshots.
Comment #4
wim leersThis is related to the long pre-existing issue #1955300: Ensure CKEditor's "Paste From Word" feature works stellarly before Drupal 8 release.
@mErilainen: Could you instead test #2521820: Update CKEditor library to 4.5.3, which should fix this? Ideally, we don't have work-arounds like this one that we have to maintain ourselves (and that WILL become outdated/incomplete).
Comment #5
merilainen commentedI did a fresh install after applying the patch in the other issue, then created a new article by copy-pasting text and it seems to work fine. Tested again from LibreOffice and Pages.
Comment #6
wim leersWoooot! :) :) Then closing this in favor of #2521820, see #2521820-26: Update CKEditor library to 4.5.3 :)