fixed file save issues

- added fileWriter.truncate() call before saving the blob in file-manager.js.
- cleaned up edit directives (made one for pure text and one for markdown)