Dirty check functionality added into UndoManager

This API is to provide the functionality to check if the document is dirty or not according the the change history.

Refer to [this](https://github.com/marijnh/CodeMirror/pull/919)