Refactored WYSIWYG editor image upload code
Refactored WYSIWYG editor image upload code

Added sketchy timeout to fix images being pasted at end of page.
Fixes #489

oomba/the-loud-cartographer,Abijeet/BookStack,Abijeet/BookStack,BookStackApp/BookStack,Abijeet/BookStack,BookStackApp/BookStack,oomba/the-loud-cartographer,oomba/the-loud-cartographer,BookStackApp/BookStack