From 0e04fff0ea80fa5cbe96b8354db38bd334aea83a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 16 Jul 2012 16:04:05 -0700 Subject: upgrade to codemirror 2.3 Signed-off-by: Ananya Sen Conflicts: js/code-editor/codemirror-ninja/theme/lesser-dark-ninja.css Signed-off-by: Ananya Sen --- imports/codemirror/mode/stex/stex.js | 10 ++++++---- imports/codemirror/mode/stex/test.html | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'imports/codemirror/mode/stex') diff --git a/imports/codemirror/mode/stex/stex.js b/imports/codemirror/mode/stex/stex.js index b89e619e..c0739ded 100644 --- a/imports/codemirror/mode/stex/stex.js +++ b/imports/codemirror/mode/stex/stex.js @@ -85,10 +85,12 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) if (source.match(/^\\[a-zA-Z@]+/)) { var cmdName = source.current(); cmdName = cmdName.substr(1, cmdName.length-1); - var plug = plugins[cmdName]; - if (typeof(plug) == 'undefined') { - plug = plugins["DEFAULT"]; - } + var plug; + if (plugins.hasOwnProperty(cmdName)) { + plug = plugins[cmdName]; + } else { + plug = plugins["DEFAULT"]; + } plug = new plug(); pushCommand(state, plug); setState(state, beginParams); diff --git a/imports/codemirror/mode/stex/test.html b/imports/codemirror/mode/stex/test.html index b53a6a24..a60f4184 100644 --- a/imports/codemirror/mode/stex/test.html +++ b/imports/codemirror/mode/stex/test.html @@ -241,6 +241,18 @@ +

New Commands

+ + Should be able to define a new command that happens to be a method on Array + (e.g. pop): + +

Summary