Open Comandeer opened 7 years ago
You can reproduce a similar problem with this:
Inspect the HTML and notice that there is an empty widget wrapper DIV right after the first image (the one you copied). This happens on Chrome but not on Firefox. I suspect that the difference between Chrome and Firefox is where the selection ends. In Firefox the selection probably ends right after the first image widget while in Chrome the selection ends inside the wrapper of the second image widget. As a result in Chrome you copy also the (empty) wrapper of the second image widget. This produces an invalid widget when pasted.
I get the following stack trace locally, with a custom unminified build of CKEditor (so the line numbers are not relevant):
Uncaught TypeError: Cannot read property 'attributes' of null
at ckeditor.js:59423
at CKEDITOR.htmlParser.element.forEach (ckeditor.js:20983)
at CKEDITOR.htmlParser.element.forEach (ckeditor.js:20997)
at CKEDITOR.htmlParser.element.forEach (ckeditor.js:20997)
at CKEDITOR.htmlParser.element.forEach (ckeditor.js:20997)
at Editor.<anonymous> (ckeditor.js:59388)
at Editor.listenerFirer (ckeditor.js:465)
at Editor.CKEDITOR.event.fire (ckeditor.js:611)
at Editor.CKEDITOR.editor.fire (ckeditor.js:735)
at CKEDITOR.htmlDataProcessor.toDataFormat (ckeditor.js:21710)
The line where it fails is this:
// If widget did not have data-cke-widget attribute before upcasting remove it.
if ( widgetElement.attributes[ 'data-cke-widget-keep-attr' ] != '1' )
delete widgetElement.attributes[ 'data-widget' ];
widgetElement
is null.
This is probably related to #1300 , #1164 and #698 .
Are you reporting a feature request or a bug?
Bug
Provide detailed reproduction steps (if any)
Expected result
Widget is pasted correctly
Actual result
Only caption from the widget is pasted and error is thrown:
Other details