Fix CodeMirror saving and dirty flag