Fix bug causing codemirror value to be reset.