Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor error, Uncaught IndexSizeError: Failed to execute 'extend' on 'Selection': 1 is larger than the given node's length

Tags:

ckeditor

After setting blurDelay = 0, then click Bold and click Paste in toolbar, it will throw the error below.

Uncaught IndexSizeError: Failed to execute 'extend' on 'Selection': 1 is larger than the given node's length.

CK version:"4.4.6",revision:"08188c4"

Only in Chrome, IE and FF will be fine

jsfiddle: http://jsfiddle.net/mfine2/98rwv6Lt/

bug ticket: http://dev.ckeditor.com/ticket/13241

Javascript code.

CKEDITOR.focusManager._.blurDelay = 0; 

var ck = CKEDITOR.replace( 'editor1', {
    fullPage: true
});

ck.on( "blur", function( evt ){
    console.log(this.getData());
});
like image 509
pig.li Avatar asked Oct 31 '22 05:10

pig.li


2 Answers

I have checked your test case and there is error being thrown in Blink browsers only (IE and FF work fine) but you are manipulating private property http://docs.ckeditor.com/#!/api/CKEDITOR.focusManager._-property-blurDelay which is for internal use of CKEditor only.

One of the reasons we use properties like this one is get rid-of subtle differences between browsers or errors that may get thrown in certain scenarios. When you leave this property untouched there is no error and I think that sums it up. You should not manipulate editor internal properties.

like image 194
j.swiderski Avatar answered Nov 13 '22 05:11

j.swiderski


The problem you encounter is probably related to : https://github.com/ryancramerdesign/ProcessWire/issues/1335

The issue is that CKEditor's getData() method fails (and produces a JS error) when called before the field is blurred, after certain conditions (like inserting an image)

It was a bug affecting chrome, opera and safari. Throwing the same JS error.
Bug FIXED since CKE v4.5.5

Still to be tested with your modification of blurDelay though.

like image 42
Rémi Levassor Avatar answered Nov 13 '22 06:11

Rémi Levassor