rem: top.editorShell.InsertElement(imageElement,true); 
add: try { top.editorShell.InsertElementAtSelection(imageElement,true); } catch (e) { dump("Exception occured in InsertElementAtSelection\n"); } 
context: function EditorAutoInsertImage(url){    var imageElement = top.editorShell.CreateElementWithDefaults("img");    // TODO: do some smartass string parsing to find relative file    //       location so we don't need this big chunky URLs..     //       must utilize document dirty flag.    imageElement.setAttribute("src",url);    // TODO: make this show the file name and size in bytes.     var altString = url.substring(url.lastIndexOf("/")+1,url.length);    imageElement.setAttribute("alt",altString);    imageElement.setAttribute("border","0");    // TODO: collect width and height attributes and insert those    //       also.    // insert the image    top.editorShell.InsertElement(imageElement,true);}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/711c0f72c9655c2558d43bb716847f1a294b8372/sb-FileWidgetFileHandler.js/clean/editor/ui/composer/content/sb-FileWidgetFileHandler.js