Opened 15 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)
Change History (19)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Component: | General → Core : 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 15 years ago by
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 15 years ago by
I have confirmed/experienced this bug in Windows XP as well. I have confirmed everything that gaellafond stated above.
comment:5 Changed 15 years ago by
Cc: | miquel@… added |
---|
comment:7 follow-up: 9 Changed 15 years ago by
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 15 years ago by
Milestone: | CKEditor 3.x → CKEditor 3.4 |
---|
Maybe we have a better solution for it.
comment:9 Changed 15 years ago by
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 15 years ago by
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 15 years ago by
Keywords: | Confirmed added |
---|---|
Owner: | set to Garry Yao |
Status: | new → assigned |
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:13 Changed 14 years ago by
Version: | 3.2 → 3.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
Version: | 3.3.1 → 3.2 |
---|
comment:15 Changed 14 years ago by
Keywords: | HasPatch added |
---|
Changed 14 years ago by
Attachment: | 5338.patch added |
---|
comment:16 Changed 14 years ago by
Owner: | changed from Garry Yao to Frederico Caldeira Knabben |
---|---|
Status: | assigned → review |
comment:17 Changed 14 years ago by
Status: | review → review_passed |
---|
comment:18 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Fixed with [5739].
By 'Ubuntu 8.10' I meant, of course, Ubuntu 9.10
Sorry!