Im working on a custom module but am having problems. I can add a new image into the editor but I can only add it to the bottom everytime like this:
window.frames[0].document.body.innerHTML += '<img src = "'+filename+'" alt = "'+filename+'" />';
Is there anyway I can append it to the current selected element / area>
window.frames[0].document.body.innerHTML += '<img src = "'+filename+'" alt = "'+filename+'" />';
Is there anyway I can append it to the current selected element / area>

Re: Adding new elements to the selected area
window.frames[0].document.body.CKEDITOR.instances.editor1.insertHtml( '<p>This is a new paragraph.</p>' );