Hi. I'm using ckeditor version 4.4.1.
My widget is throwing the following exception when I try to paste from an existing widget:
Uncaught TypeError: Cannot read property 'scrollIntoView' of undefined ckeditor.js:406CKEDITOR.dom.selection.scrollIntoView ckeditor.js:406n ckeditor.js:325(anonymous function) ckeditor.js:361CKEDITOR.editable.CKEDITOR.tools.createClass.proto.insertHtml ckeditor.js:328(anonymous function) ckeditor.js:334i ckeditor.js:10CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12CKEDITOR.editor.CKEDITOR.editor.fire ckeditor.js:13CKEDITOR.tools.extend.insertHtml ckeditor.js:244(anonymous function) ckeditor.js:613i ckeditor.js:10CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12CKEDITOR.editor.CKEDITOR.editor.fire ckeditor.js:13f ckeditor.js:594(anonymous function) ckeditor.js:599(anonymous function)
This is the original source code throwing an exception:
scrollIntoView: function(){ this.type!=CKEDITOR.SELECTION_NONE&&this.getRanges()[0].scrollIntoView() }
"this.type" and "this.getRanges()[0]" are "undefined".
I've downloaded the last version of the source code to check this and it's like this:
scrollIntoView: function() { // Scrolls the first range into view. if ( this.type != CKEDITOR.SELECTION_NONE ) this.getRanges()[ 0 ].scrollIntoView(); }
This also fails (I tested this new code on my version 4.4.1, only).
I've changed it to:
scrollIntoView: function(){ if(this.type && this.getRanges()[0]){ this.type!=CKEDITOR.SELECTION_NONE&&this.getRanges()[0].scrollIntoView() } }
And it's now working.
I would like to know if that's a bug or not (because it could be something related to my widget's building).
Note: My widget encapsulates svg content:
<svg width="83" height="41" xmlns="http://www.w3.org/2000/svg"> <!-- comment --> <g> <title>Layer 1</title> <rect id="svg_1" height="36" width="78" y="2.5" x="2.5" stroke-width="5" stroke="#000000" fill="#FF0000"></rect> </g> </svg>
Thanks for your attention.