Opened 6 years ago

Last modified 6 years ago

#10402 confirmed Bug

TypeError: A/range is undefined when calling insertHtml after hide/show.

Reported by: martin Owned by:
Priority: Normal Milestone:
Component: Core : Editable Version: 3.4
Keywords: Firefox Cc:

Description

Repoducible on the Demo Page:

http://ckeditor.com/demo

var cke = CKEDITOR.instances.editor1
jQuery('#demo-standard').hide();
jQuery('#demo-standard').show();
cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');

Result:

TypeError: A is undefined

TypeError: range is undefined (with uncompressed sources)

I tested this against release/4.1.x 3cb9cc24ed187a8ad29b810798f3427cc45a6fcf

Change History (6)

comment:1 Changed 6 years ago by Piotrek Koszuliński

Status: newconfirmed
Version: 4.1.14.0

Reproducible on Firefox. Issue thrown from editable.js:975. It is reproducible from at least CKE 4.0.

comment:2 Changed 6 years ago by Jakub Ś

I have tried below code in demo page, local CKEditor 4.1.1 and local CKEditor git. This was all tested in latest Firefox 21. No code produced error you talk about.

var cke = CKEDITOR.instances.editor1;
document.getElementById('demo-standard').style.display='none';
document.getElementById('demo-standard').style.display='';
cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');

var cke = CKEDITOR.instances.editor1;
document.getElementById('cke_editor1').style.display='none';
document.getElementById('cke_editor1').style.display='';
cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');

var cke = CKEDITOR.instances.editor1
jQuery('#cke_editor1').hide();
jQuery('#cke_editor1').show();
cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');

Perhaps latest FF update has fixed this.

@martin. or @Reinmar are you still getting this error?

comment:3 Changed 6 years ago by Jakub Ś

Keywords: Firefox added
Version: 4.03.4

Om after consulting this with @reinmar it has turned out that you have to execute code in parts. Running whole code works but if you try executing in Firbug console:

var cke = CKEDITOR.instances.editor1
jQuery('#cke_editor1').hide();

then after few seconds

jQuery('#cke_editor1').show();
cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');

Problem can be reproduced in FF only from CKEditor 3.4 and exists also in CKEditor 4.x.

JS ERROR:
Messsage: range is undefined
Line: 975
Code: if ( range.checkReadOnly() )
Uri: /ckeditor4/core/editable.js

comment:4 Changed 6 years ago by Piotrek Koszuliński

I wonder if this issue will be fixed by #10438.

Also... I'm not sure whether this is a valid issue. Editor should be focused before calling insertHtml.

comment:5 Changed 6 years ago by Jakub Ś

@Reinmar I have tried changed second part of code but result was the same. It seems when insertHTML is executed error occurs (in below case after second):

var cke = CKEDITOR.instances.editor1
document.getElementById('cke_editor1').style.display='none';

document.getElementById('cke_editor1').style.display='';
cke.focus();
window.setTimeout(function(){cke.insertHtml('<img src="http://b.cksource.com/a/1/img/sample.jpg" />');},1000);

comment:6 Changed 6 years ago by Piotrek Koszuliński

After discussing this with others, I think that it should work even without focus. So this is of course a valid issue. And unfortunately it does not seem to be fixed by #10438.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy