Hi,
I am working on a plugin for Hallo.js which should insert an image where the current selection is.
First off, I apologize for the following code snippets, they are in CoffeeScript. I am willing to convert them to JS if necessary, but I think the code can be understood without doing that.
I have tried it with:
document.execCommand "insertImage", null, source
This didn't work.
Meanwhile I do something like that:
txtNode = document.createTextNode("Hello. This is a new node.")
range.insertNode(txtNode)
which actually does work. It inserts a new text node to the right place.
This doesn't work:
link = document.createElement('a')
link.setAttribute('href', 'mypage.htm')
range.insertNode(a)
...and it also doesn't work with an image.
There is simply no new dom element appearing.
Any ideas whats going on?
I have tried rangy 1.2.x and the current development version
Thanks!
Christian