[MAGNOLIA-4051] Copy from word not cleaning up content properly, results in layout issues Created: 07/Feb/12  Updated: 29/Mar/12  Resolved: 28/Mar/12

Status: Closed
Project: Magnolia
Component/s: fckeditor
Affects Version/s: 4.5.1
Fix Version/s: 4.5.2

Type: Improvement Priority: Critical
Reporter: Boris Kraft Assignee: Federico Grilli
Resolution: Not an issue Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2012-02-07 at 14.13.24.png     PNG File Screen Shot 2012-02-07 at 14.18.39.png     PNG File paste-from-msword-no-styles-removal.png     PNG File paste-from-msword-with-styles-removal.png    
Issue Links:
causality
is causing DOCU-267 Update FCK module doc with a note abo... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

If you paste text into STK's FCKEditor that apparently has some layout/styling info (Rich text), and use the "copy from word" button, and select all options to remove styling from pasted text, the result will still be layout issues. This is tested with betaV, but we have the same issue on our corporate site. To generate the text to paste I have used "Littleipsum" a small tool that generates lore ipsum text.

I have often encountered this issue when given a demo, where obviously I need to show how to create page components, and pasting content is the fastest way to generate a result.

To me it seems that the "paste from word" function is not working properly. See screenshot of the resulting layout, where the text is much smaller than it should be.

On a related note, when creating a new text/image, it seems there is an invisible character in the text. When I delete this space, and just copy text into FCKeditor, the resulting text will not be shown at all.



 Comments   
Comment by Jan Haderka [ 14/Mar/12 ]

First only investigate if upgrade of FCK will fix the problem and what are the side effects of such update.

Comment by Federico Grilli [ 27/Mar/12 ]

Attached two screenshots with ms word copy&paste, with and without styles removed. FCK functionality seems to work correctly in the sense that extraneous styles are removed when selecting Remove styles definitions in the pop dialog. However, I was able to reproduce the issue by reusing the same paragraph/component. In that case, it seems that pasting a new text results in FCKEditor wrapping it in a <div> element which in the case of STK applies a different style, namely one where font-size is smaller than in text wrapped in <p> element (the default behavior). I have a feeling I already dealt with a similar/related issue and maybe there's a reason why the text is wrapped into a div but have to dig into jira.

Comment by Federico Grilli [ 27/Mar/12 ]

My feeling must have been wrong, because I could not find any issue related to that, apart from MAGNOLIA-3185 where I upgraded to the latest release of FCKEditor 2.6.x branch (later on it became CKEditor 3.x and many config options have changed so that it looked not so trivial to upgrade and keep our module backward compatible). Anyway, it looks like FCKEditor wraps text copied from Word into a <div> hence the problem. However, pasting as plain text seems not to do the same, so I guess we could do the following

  • Enforce FCKConfig.ForcePasteAsPlainText = true ; this would remove all styles from the pasted text w/o wrapping it into a div. However, it should also disable the Paste from Word button in the toolbar which could disorient users accustomed to it.
  • Remove any formatting server-side before saving the the text into the repo. Again, this might be unexpected behavior for some users, unless we add a new config option for that so users can enable/disable it
  • Solve it via javascript by overriding the fck function which adds the div but that might cause maintenance troubles and new weird bugs
  • Do nothing and simply state in our module's doc: prefer paste as plain text over paste from word if you want to avoid potential css issues with text wrapped by <div>. Enforcing such behavior can always be done by overriding the FCKConfig.ForcePasteAsPlainText = true in /magnolia-module-fckeditor/src/main/resources/mgnl-resources/fckeditor/custom/config/magnoliaStandard.js

Err, maybe the first two options are silly because one could argue: what's the point of having a rich text editor if you are removing all formatting by default? The fourth option is my favorite, of course.

Comment by Federico Grilli [ 28/Mar/12 ]

I would do nothing here and just add a note in the FCK module documentation about the "issue" with Paste from Word as I stated in my previous comment.

Generated at Mon Feb 12 03:52:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.