Show More
@@ -624,7 +624,8 b' define([' | |||||
624 | var info = (mode && mode.mode && mode.mime && mode) || |
|
624 | var info = (mode && mode.mode && mode.mime && mode) || | |
625 | CodeMirror.findModeByName(modename) || |
|
625 | CodeMirror.findModeByName(modename) || | |
626 | CodeMirror.findModeByExtension(modename.split(".").slice(-1)) || |
|
626 | CodeMirror.findModeByExtension(modename.split(".").slice(-1)) || | |
627 |
CodeMirror.findModeByMIME(modename) |
|
627 | CodeMirror.findModeByMIME(modename) || | |
|
628 | {mode: modename, mime: modename}; | |||
628 |
|
629 | |||
629 | require([ |
|
630 | require([ | |
630 | // might want to use CodeMirror.modeURL here |
|
631 | // might want to use CodeMirror.modeURL here |
@@ -41,12 +41,10 b' function($,' | |||||
41 | cm.clearHistory(); |
|
41 | cm.clearHistory(); | |
42 |
|
42 | |||
43 | // Find and load the highlighting mode |
|
43 | // Find and load the highlighting mode | |
44 |
|
|
44 | utils.requireCodeMirrorMode(model.mimetype, function(spec) { | |
45 | if (modeinfo) { |
|
45 | var mode = CodeMirror.getMode({}, spec); | |
46 | utils.requireCodeMirrorMode(modeinfo.mode, function() { |
|
46 | cm.setOption('mode', mode); | |
47 | cm.setOption('mode', modeinfo.mode); |
|
47 | }); | |
48 | }); |
|
|||
49 | } |
|
|||
50 | that.save_enabled = true; |
|
48 | that.save_enabled = true; | |
51 | }, |
|
49 | }, | |
52 | function(error) { |
|
50 | function(error) { |
@@ -1587,14 +1587,14 b' define([' | |||||
1587 | codecell.CodeCell.options_default.cm_config.mode = newmode; |
|
1587 | codecell.CodeCell.options_default.cm_config.mode = newmode; | |
1588 |
|
1588 | |||
1589 | var that = this; |
|
1589 | var that = this; | |
1590 | utils.requireCodeMirrorMode(newmode, function () { |
|
1590 | utils.requireCodeMirrorMode(newmode, function (spec) { | |
1591 | that.get_cells().map(function(cell, i) { |
|
1591 | that.get_cells().map(function(cell, i) { | |
1592 | if (cell.cell_type === 'code'){ |
|
1592 | if (cell.cell_type === 'code'){ | |
1593 |
cell.code_mirror.setOption('mode', |
|
1593 | cell.code_mirror.setOption('mode', spec); | |
1594 | // This is currently redundant, because cm_config ends up as |
|
1594 | // This is currently redundant, because cm_config ends up as | |
1595 | // codemirror's own .options object, but I don't want to |
|
1595 | // codemirror's own .options object, but I don't want to | |
1596 | // rely on that. |
|
1596 | // rely on that. | |
1597 |
cell.cm_config.mode = |
|
1597 | cell.cm_config.mode = spec; | |
1598 | } |
|
1598 | } | |
1599 | }); |
|
1599 | }); | |
1600 | }); |
|
1600 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now