Render the right template on POST fail
Add autosave feature
Restore the document when cancel is clicked
Move dirtyness check in the event timeout callback
Add missing var declarations
Use images for the preview toggle