kogmbh/WebODF — pull request #105 by kossebau (2013-10-04 11:22:16+00:00)
Title: Improve ImageInserter: use img.onload, drop hidden image helper after usage, call onToolDone only when really done

Old code used its own event checker with the insertImageIfLoaded loop, using onload should make things more reliable and simpler.
onToolDone could be called before editorSession.insertImage, if the image loading would take some more time and the timeout was used in insertImageIfLoaded.
And removing the hidden image should save a little bit of memory again once things are done. Do not think that caching (if the same image is inserted multiple times in a row) is that helpful, so let's just drop it as soon as possible.