fix syntax highlight switch

This commit is contained in:
azivner 2018-01-23 19:51:16 -05:00
parent 27f12a0186
commit 403cf02ea7

View File

@ -149,14 +149,11 @@ const noteEditor = (function() {
codeEditor.setValue(currentNote.detail.note_text); codeEditor.setValue(currentNote.detail.note_text);
const info = CodeMirror.findModeByMIME(currentNote.detail.mime); const info = CodeMirror.findModeByMIME(currentNote.detail.mime);
let mode = null;
if (info) { if (info) {
mode = info.mode; codeEditor.setOption("mode", info.mime);
CodeMirror.autoLoadMode(codeEditor, info.mode);
} }
CodeMirror.autoLoadMode(codeEditor, mode);
codeEditor.setOption("mode", mode);
} }
else { else {
throwError("Unrecognized type " + currentNote.detail.type); throwError("Unrecognized type " + currentNote.detail.type);