codemirror / CodeMirror-v1

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version
http://codemirror.net/
Other
362 stars 63 forks source link

loadmode plugin does not work over non string modes #63

Closed captn3m0 closed 12 years ago

captn3m0 commented 12 years ago

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);
captn3m0 commented 12 years ago

Accidentally opened in old repo