PDA

View Full Version : ExtJs 4.2 IMG insert Htmleditor under IE11



Programmers
18 Nov 2014, 4:03 AM
Dear Sencha team and community members,

I use ExtJs 4.2

I'm trying an image with IMG tag so "<img...>" to insert into the text of the HTML Editor


I'm here almost despair.
My statement is as follows.

for all versions of sencha, I found the same error.

Here the code by trying to eliminate this error.




Ext.isIE11 = !!navigator.userAgent.match(/Trident/) && !!navigator.userAgent.match(/rv:11/);






insertAtCursor : function(text) {
if (!this.activated) {
return;
}
if (Ext.isIE) {
this.win.focus();
var doc = this.getDoc(), r = doc.selection.createRange();
if (r) {
r.pasteHTML(text);
this.syncValue();
this.deferFocus();
}
} else if (Ext.isIE11) {
this.win.focus();
var doc = this.getDoc(), r = doc.getSelection().getRangeAt(0);
if (r) {
var fragment = r.createContextualFragment(text);

doc.body.appendChild(fragment);

this.syncValue();
this.deferFocus();
}
}
else {
this.win.focus();
this.execCmd('InsertHTML', text);
this.deferFocus();
}
}



Here the original code from the ext-all.js




insertAtCursor:function(c){
var b=this,
a;
if(b.activated){b.win.focus();
if(Ext.isIE){a=b.getDoc().selection.createRange();
if(a){
a.pasteHTML(c);
b.syncValue();
b.deferFocus()
}
}else{
b.execCmd("InsertHTML",c);
b.deferFocus()
}
}
},



in all versions, the originalcode is used.

has been working at all on the issue?

Under Chrome and Firefox it works

Maybe someone of you has found a way that allows the IE11 perform this function.

I would really appreciate help

joel.watson
20 Nov 2014, 7:45 AM
Hi--

Sorry, I'm not quite following what the issue is that you're experiencing. Can you share a test case either here or (ideally) by creating a Fiddle at https://fiddle.sencha.com/#fiddle. I'll be happy to test this issue with you.

Thanks!