Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#7371 closed Bug (fixed)

Setting CKEDITOR.config.pasteFromWordRemoveFontStyles to false throws an exception when pasting from word

Reported by: Michael Camden Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version: 3.5.2
Keywords: HasPatch Cc: satya_minnekanti@…

Description

TypeError: Cannot call method 'match' of null

File: pastefromword/filters/default.js
Ln 1121:
Parent Method: CKEDITOR.cleanWord calling dataProcessor.toHtml

I've traced the error to the following call stack:
Ln 897: calling stylesFilter with an array, which later calls styleMigrateFilter
Ln 546: styleMigrateFilter attempts to create a CKEDITOR.htmlParser.element object with the null parameter. Since the element doesn't have a tagName, .match is called on null (core/htmlparser/element.js ln: 40) which throws an exception.

Tested on Firefox 3, and Chrome.

I've attached the example document that I was using to test pasting.

Attachments (1)

BugReport_Example.docx (10.8 KB) - added by Michael Camden 13 years ago.
Example I used to test

Download all attachments as: .zip

Change History (8)

Changed 13 years ago by Michael Camden

Attachment: BugReport_Example.docx added

Example I used to test

comment:1 Changed 13 years ago by Michael Camden

Suggested fix:

File: pastefromword/filters/default.js
Ln 552:
Replace, var styleElement = new CKEDITOR.htmlParser.element( null ),
With, var styleElement = new CKEDITOR.htmlParser.element( 'span' ),

comment:2 Changed 13 years ago by Sa'ar Zac Elias

Keywords: pastefromword exception thrown pasting removed

comment:3 Changed 13 years ago by Satya Minnekanti

Cc: satya_minnekanti@… added

comment:4 Changed 13 years ago by Frederico Caldeira Knabben

Keywords: HasPatch added

comment:5 Changed 13 years ago by Wiktor Walc

Status: newconfirmed

Confirmed in 3.5.2, to reproduce this issue make sure to set in config.js

config.pasteFromWordRemoveFontStyles = false;

and comment out the try/catch statement around line 1127 in pastefromword/filters/default.js, because otherwise an alert message is displayed.

@mrfr0g - are you still able to reproduce this issue using the Nightly Build?

comment:6 Changed 13 years ago by Michael Camden

Resolution: fixed
Status: confirmedclosed

The nightly build appears to fix the problem.

comment:7 Changed 10 years ago by Frederico Caldeira Knabben

Component: Core : PastingPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy