Fix some state and interactivity issues with TextEditorView.

When canceling the editor, the Markdown checkbox wouldn't revert to the
original state. Toggling the Markdown state also failed to mark the
editor as dirty or emit a change signal.

These have been fixed, and unit tests added.

Reviewed at https://reviews.reviewboard.org/r/6541/