Hello,
I've been wracking my brains for a week trying to figure out how to wrap an image that is in the editor with an HREF tag. IE 8 works great but when in compatibility mode, it either makes whatever is selected in the editor window disappear, or it does nothing ( depending how I'm tinkering at the moment ). My code is below.
Please, how do I do this in pre IE 8 browsers?
Thanks in Advance.
I've been wracking my brains for a week trying to figure out how to wrap an image that is in the editor with an HREF tag. IE 8 works great but when in compatibility mode, it either makes whatever is selected in the editor window disappear, or it does nothing ( depending how I'm tinkering at the moment ). My code is below.
Please, how do I do this in pre IE 8 browsers?
Thanks in Advance.
g = opener.CKEDITOR.instances.theCompText; // Your ckeditor var type = g.getSelection().document.$.selection.type; selection = g.getSelection().document.$.selection.createRange().text; if (opener.CKEDITOR.env.ie) { if(g.getSelection().document.$.selection.type == "Control") { var theControlRange = g.getSelection().document.$.selection.createRange(); for (i = 0; i < theControlRange.length; i++) { if(theControlRange(i).tagName == "IMG") { var temp = theControlRange(i).src; var imagePath = temp.substr(temp.indexOf(".net")+4); opener.CKEDITOR.instances.theCompText.insertHtml(preText + "<img style='border:0px' src='" + imagePath + "' alt='" + theControlRange(i).alt + "' title='" + theControlRange(i).title + "' height='" + theControlRange(i).height + "'width='" + theControlRange(i).width + "' /></a>"); } } } }