##// END OF EJS Templates
BUG: Fix broken codemirror highlighting on file rename....
Scott Sanderson -
Show More
@@ -97,14 +97,17 b' function($,'
97 97
98 98 Editor.prototype._set_mode_for_model = function (model) {
99 99 /** Set the CodeMirror mode based on the file model */
100
100
101 101 // Find and load the highlighting mode,
102 102 // first by mime-type, then by file extension
103 var modeinfo = CodeMirror.findModeByMIME(model.mimetype);
104 if (modeinfo.mode === "null") {
103 var modeinfo;
104 if (model.mimetype) {
105 modeinfo = CodeMirror.findModeByMIME(model.mimetype);
106 }
107 if (!modeinfo || modeinfo.mode === "null") {
105 108 // find by mime failed, use find by ext
106 109 var ext_idx = model.name.lastIndexOf('.');
107
110
108 111 if (ext_idx > 0) {
109 112 // CodeMirror.findModeByExtension wants extension without '.'
110 113 modeinfo = CodeMirror.findModeByExtension(model.name.slice(ext_idx + 1));
@@ -114,7 +117,7 b' function($,'
114 117 this.set_codemirror_mode(modeinfo);
115 118 }
116 119 };
117
120
118 121 Editor.prototype.set_codemirror_mode = function (modeinfo) {
119 122 /** set the codemirror mode from a modeinfo struct */
120 123 var that = this;
General Comments 0
You need to be logged in to leave comments. Login now