Opened 6 years ago

Closed 2 years ago

Last modified 2 years ago

#10011 closed Bug (fixed)

pasteFromWordRemoveFontStyles ignored in IE9 under certain conditions

Reported by: Andy Watson Owned by:
Priority: Normal Milestone: CKEditor 4.6.0
Component: Plugin : Paste from Word Version: 3.0
Keywords: IE9 IE10 Cc:

Description (last modified by Jakub Ś)

Summary: When copying from a Microsoft word document using IE font tags are copied over despite config.pasteFromWordRemoveFontStyles set as true in the config.js.

Steps to reproduce: When you copy part or all of the line of text (but not the paragraph mark at the end) into the editor, the original formatting is retained. However, if you include the paragraph mark at the end of the line, the font tags are correctly stripped. The font is Arial 20 bold, but if changed it to, say, Algerian 20 bold, the font is also correctly stripped on import.

This only happens in IE. I cannot reproduce in Chrome or Firefox.

Browser name and OS: IE9 & Windows 7

Edit:
Please see comment:6 for way to reproduce.

Attachments (7)

CMSPasteTest-1.docx (12.6 KB) - added by Andy Watson 6 years ago.
Word document with text formatted to reproduce suspected bug
Capture.JPG (111.2 KB) - added by Andy Watson 6 years ago.
supporting screenshot
Capture.2.JPG (101.4 KB) - added by Andy Watson 6 years ago.
IE9 - text copied without carriage return
Capture.3.JPG (109.6 KB) - added by Andy Watson 6 years ago.
IE9 - text copied without carriage return - showing CK Source Code
Capture.4.JPG (96.7 KB) - added by Andy Watson 6 years ago.
IE9 - text copied WITH carriage return
Capture.5.JPG (96.0 KB) - added by Andy Watson 6 years ago.
IE9 - text copied WITH carriage return - showing CK Source Code
Word.png (29.1 KB) - added by Jakub Ś 6 years ago.

Download all attachments as: .zip

Change History (17)

Changed 6 years ago by Andy Watson

Attachment: CMSPasteTest-1.docx added

Word document with text formatted to reproduce suspected bug

comment:1 Changed 6 years ago by Jakub Ś

Status: newpending
Version: 4.0.1

I wasn't able to get results you were having.

  1. These two options are actually set to true by default so there is no need to set them:
    config.pasteFromWordRemoveFontStyles=true;
    config.pasteFromWordRemoveStyles = true; 
    
  2. In my case the results were E.g.:
    <p align="center" dir="RTL"><strong><span dir="LTR">SOME EXAMPLE TEXT IN ARIAL 20 BOLD</span></strong></p>
    <p align="center">&nbsp;</p>
    or
    <p><strong>EXAMPLE TEXT IN ARIAL </strong></p>
    

All I got was strong tags.


  1. Does it happen in demo page or only in CKEditor integrated into your application?
  2. If in your application then are there any configurations options that you have forgotten to mention?
  3. Have you got any custom changes or plugins that might influence this?

comment:2 Changed 6 years ago by Andy Watson

Hi there,

Actually testing again in Firefox seems to present similar results. This is happening on the CKEditor demo as well as our installation.

I've attached a screenshot of the CKEditor demo page of what happens when copying only the phrase "SOME EXAMPLE TEXT IN ARIAL 20 BOLD" from the attached word document (no spaces and no carriage return) and what happens when copying and pasting the whole block including carriage return.

Changed 6 years ago by Andy Watson

Attachment: Capture.JPG added

supporting screenshot

comment:3 Changed 6 years ago by Andy Watson

Actually scratch that, it's just IE. See further screenshots (attached).

Changed 6 years ago by Andy Watson

Attachment: Capture.2.JPG added

IE9 - text copied without carriage return

Changed 6 years ago by Andy Watson

Attachment: Capture.3.JPG added

IE9 - text copied without carriage return - showing CK Source Code

Changed 6 years ago by Andy Watson

Attachment: Capture.4.JPG added

IE9 - text copied WITH carriage return

Changed 6 years ago by Andy Watson

Attachment: Capture.5.JPG added

IE9 - text copied WITH carriage return - showing CK Source Code

comment:4 Changed 6 years ago by Jakub Ś

Looks like code in first example is not cleaned. Aren't you getting any alerts or error messages in console when you paste this code?

I have tried few times on IE9 with default setting but with no luck.

Could you tell me:

  1. Have you got any plugins in IE9 that might influence this behaviour? Could you check this on browser with default settings?
  2. Has MS word any non-default settings that might cause that? You have mentioned something about paragraph mark. Have you got e.g. show printable characters turned on or any other option?
  3. Which office version is that?

comment:5 Changed 6 years ago by Andy Watson

Hi,

I don't use IE other than when testing so it's running pretty much out the box. The only add-ons are Adobe PDF, Adobe Flash, Silverlight and Office Document Cache Handler.

I'm using Word 2010 running on default settings and the paragraph return I mentioned is not visible but when selected via Ctrl + A it allows for reproduction of this issue vs selecting only the text itself.

The problem was initially reported to us by a client so I don't believe this is only related/reproducible on our internal system. The client who reported this issue is also using IE9 although I'm not sure what operating system I suspect Windows 7.

I've tried to reproduce this in a virtual machine running XP and IE8 without success so it seems to be a combination of IE9, Windows7 and Word that produces this problem.

Thanks

comment:6 Changed 6 years ago by Jakub Ś

Keywords: IE9 IE10 added
Status: pendingconfirmed
Version: 3.0

I have finally managed to reproduce this is IE9 and IE10 from CKEditor 3.0 and in CKEditor 4.x (v4).

To reproduce:

  1. Open replacebycode sample
  2. Put cursor in before first character and press enter.
  3. If element is other than P please change it to P with format dropdown
  4. Copy text from CMSPasteTest-1.docx​ as shown in Word.png
  5. Paste text using Ctrl+V (PasteFromWord toolbar button seems to works fine)
  6. Switch to source to see the code.

You can always try below shorter TC. I was not however able to reproduce this issue always thus I have also pasted the above TC.

To reproduce:

  1. Open replacebycode sample
  2. Clear editor contents with newpage command.
  3. Copy text from CMSPasteTest-1.docx​ as shown in Word.png
  4. Paste text using Ctrl+V (PasteFromWord toolbar button seems to works fine)
  5. Switch to source to see the code.

Changed 6 years ago by Jakub Ś

Attachment: Word.png added

comment:7 Changed 6 years ago by Jakub Ś

Description: modified (diff)

comment:8 Changed 5 years ago by Frederico Caldeira Knabben

Component: Core : PastingPlugin : Paste from Word

comment:9 Changed 2 years ago by Tade0

Resolution: fixed
Status: confirmedclosed

Overall this feature works as long as one takes into account: ticket:16653.

comment:10 Changed 2 years ago by Anna Tomanek

Milestone: CKEditor 4.6.0
Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy