Opened 14 years ago

Closed 14 years ago

#5338 closed Bug (fixed)

Paste from Open Office causes error

Reported by: David Evans Owned by: Frederico Caldeira Knabben
Priority: Normal Milestone: CKEditor 3.4
Component: Core : Pasting Version: 3.2
Keywords: Confirmed HasPatch Cc: miquel@…, gandhi007

Description

When pasting from Open Office into CKEditor in Firefox, an error is thrown when attempting to save or use the Source button.

The error is in plugins/htmldataprocessor/plugin.js line 192:

element.children[ 0 ].value = element.attributes[ '_cke_title' ];

element.attributes._cke_title is undefined

It is possible that this error is a consequence of the empty title element which Open Office creates.

Note that this error does not occur in Chromium 5.0.330.0, which is the only other browser I have tested in.

To reproduce:

  • Create a document in Open Office
  • Copy some content from it
  • Paste it into a CKEditor instance in Firefox
  • Click the 'Source' button

Using:

  • CKEditor 3.2 (also tested on Nightly)
  • Firefox 3.5.8 (Ubuntu 8.10)
  • Open Office 3.11

Attachments (1)

5338.patch (538 bytes) - added by Frederico Caldeira Knabben 14 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 14 years ago by David Evans

By 'Ubuntu 8.10' I meant, of course, Ubuntu 9.10

Sorry!

comment:2 Changed 14 years ago by Jakub Królikowski

Component: GeneralCore : Pasting
Milestone: CKEditor 3.x

It's not only the problem of this error. When pasting from OpenOffice to CKEditor data from the field are not going with POST on submit - data aren't saving in the CKEditor area.

comment:3 Changed 14 years ago by Gael

Bug confirm on Windows XP

  • CKEditor 3.2 and 3.2.1
  • Firefox
  • OpenOffice

The Bug do NOT occur with:

  • OpenOffice + IE

nor

  • MsWord + Firefox

It's specific to OO and Firefox.

NOTE: Tested with the demo pages:
3.2: http://ckeditor.com/demo
3.2.1: http://nightly.ckeditor.com/5375/ckeditor.js

comment:4 Changed 14 years ago by shellsterdude

I have confirmed/experienced this bug in Windows XP as well. I have confirmed everything that gaellafond stated above.

comment:5 Changed 14 years ago by Miquel Rodriguez Telep

Cc: miquel@… added

comment:6 Changed 14 years ago by Alfonso Martínez de Lizarrondo

Cc: gandhi007 added

#5624 has been marked as dup

comment:7 Changed 14 years ago by aogon

quick fix:

if( element != undefined && element.children != undefined && element.children[ 0 ] != undefined ) element.children[ 0 ].value = (element.attributes[ '_cke_title' ]==undefined ? element.attributes[ '_cke_title' ] : '');

this should do the trick :)

comment:8 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.xCKEditor 3.4

Maybe we have a better solution for it.

comment:9 in reply to:  7 Changed 14 years ago by Gael

Replying to aogon:

quick fix:

if( element != undefined && element.children != undefined && element.children[ 0 ] != undefined ) element.children[ 0 ].value = (element.attributes[ '_cke_title' ]==undefined ? element.attributes[ '_cke_title' ] : '');

this should do the trick :)

Thanks, it's working.
I think you invert the elements on your conditional statement:

(element.attributes[ '_cke_title' ]==undefined ? element.attributes[ '_cke_title' ] : '')

should be

(element.attributes[ '_cke_title' ]==undefined ? '' : element.attributes[ '_cke_title' ])

comment:10 Changed 14 years ago by Gael

NOTE:
FYI the patch has to be apply on the file:

ckeditor/_source/plugins/htmldataprocessor/plugin.js

You also need to run CKEditor from source:

<script type="text/javascript" src="ckeditor/ckeditor_source.js"></script>

instead of

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

comment:11 Changed 14 years ago by Garry Yao

Keywords: Confirmed added
Owner: set to Garry Yao
Status: newassigned

Thanks for the efforts all, but please check this page when contributing.

Here, we need a dedicate processing for Oo, just like we [ http://dev.fckeditor.net/browser/CKEditor/trunk/_source/plugins/pastefromword/filter/default.js#L1104

did] for MS-Word, where basic cleanup is required since Oo is not doing as well as MS Office in the sense of dealing with clipboard.

comment:12 Changed 14 years ago by Frederico Caldeira Knabben

For now, we must simply avoid the js error.

comment:13 Changed 14 years ago by TEHEK

Version: 3.23.3.1

The same issue persists with: CKEditor 3.3.1 Firefox 3.6.3 (Windows Vista) Open Office 3.2.0


To hotfix it in your ckeditor.js :

Find the following string:

title:function(Q){Q.children[0].value=Q.attributes._cke_title;}}

And replace it with:

title:function(Q){if(Q&&Q.children&&Q.children[0])Q.children[0].value=Q.attributes._cke_title||'';}}

In _sources/plugins/htmldataprocessor/plugin.js:

Find lines 202-205:

title : function( element )
{
	element.children[ 0 ].value = element.attributes[ '_cke_title' ];
}

replace with:

title : function( element )
{
	if ( element && element.children && element.children[0])
		element.children[ 0 ].value = element.attributes[ '_cke_title' ] || '';
}

Basically the method "title" doesn't check if the passed argument is an existing node. This hotfix performs a basic check and returns empty string if element.attributes[ '_cke_title' ] is not set.

comment:14 Changed 14 years ago by Alfonso Martínez de Lizarrondo

Version: 3.3.13.2

comment:15 Changed 14 years ago by Frederico Caldeira Knabben

Keywords: HasPatch added

Changed 14 years ago by Frederico Caldeira Knabben

Attachment: 5338.patch added

comment:16 Changed 14 years ago by Frederico Caldeira Knabben

Owner: changed from Garry Yao to Frederico Caldeira Knabben
Status: assignedreview

comment:17 Changed 14 years ago by Sa'ar Zac Elias

Status: reviewreview_passed

comment:18 Changed 14 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: review_passedclosed

Fixed with [5739].

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