codemirror/CodeMirror-v1

loadmode plugin does not work over non string modes

captn3m0 opened this issue · 1 comments

The json mode works with the mode being {name:'javascript',json:true}.

Running

CodeMirror.autoLoadMode(editor,{name:'javascript',json:true});

results in mode being converted to string and not being loaded. A simple type check for mode being an object fixes this (in loadmode.js)

mode = typeof mode == 'object' ? mode.name : mode;
script.src = CodeMirror.modeURL.replace(/%N/g, mode);

Accidentally opened in old repo