Show More
@@ -612,21 +612,19 define([ | |||||
612 | * require and callback with the resolveable mode string: mime or |
|
612 | * require and callback with the resolveable mode string: mime or | |
613 | * custom name |
|
613 | * custom name | |
614 | */ |
|
614 | */ | |
615 | if (typeof mode != "string") mode = mode.name; |
|
|||
616 |
|
615 | |||
617 | if (CodeMirror.modes.hasOwnProperty(mode)) { |
|
616 | var modename = (typeof mode == "string") ? mode : | |
|
617 | mode.mode || mode.name; | |||
|
618 | ||||
|
619 | if (CodeMirror.modes.hasOwnProperty(modename)) { | |||
618 | callback(mode); |
|
620 | callback(mode); | |
619 | return; |
|
621 | return; | |
620 | } |
|
622 | } | |
621 |
|
623 | |||
622 |
var info = |
|
624 | var info = (mode && mode.mode && mode.mime && mode) || | |
623 |
CodeMirror.findModeBy |
|
625 | CodeMirror.findModeByName(modename) || | |
624 |
CodeMirror.findModeBy |
|
626 | CodeMirror.findModeByExtension(modename.split(".").slice(-1)) || | |
625 |
|
627 | CodeMirror.findModeByMIME(modename); | ||
626 | if(!info){ |
|
|||
627 | errback && errback(); |
|
|||
628 | return; |
|
|||
629 | } |
|
|||
630 |
|
628 | |||
631 | require([ |
|
629 | require([ | |
632 | // might want to use CodeMirror.modeURL here |
|
630 | // might want to use CodeMirror.modeURL here |
@@ -1585,10 +1585,9 define([ | |||||
1585 | } |
|
1585 | } | |
1586 | this.codemirror_mode = newmode; |
|
1586 | this.codemirror_mode = newmode; | |
1587 | codecell.CodeCell.options_default.cm_config.mode = newmode; |
|
1587 | codecell.CodeCell.options_default.cm_config.mode = newmode; | |
1588 | var modename = newmode.mode || newmode.name || newmode; |
|
|||
1589 |
|
1588 | |||
1590 | var that = this; |
|
1589 | var that = this; | |
1591 |
utils.requireCodeMirrorMode(mode |
|
1590 | utils.requireCodeMirrorMode(newmode, function () { | |
1592 | that.get_cells().map(function(cell, i) { |
|
1591 | that.get_cells().map(function(cell, i) { | |
1593 | if (cell.cell_type === 'code'){ |
|
1592 | if (cell.cell_type === 'code'){ | |
1594 | cell.code_mirror.setOption('mode', newmode); |
|
1593 | cell.code_mirror.setOption('mode', newmode); |
General Comments 0
You need to be logged in to leave comments.
Login now