Skip to content

Commit 001e07f

Browse files
authored
[runmode addon] Reuse existing support code for standalone/node versions of runmode
1 parent 215c1dc commit 001e07f

File tree

11 files changed

+155
-385
lines changed

11 files changed

+155
-385
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
.idea
99
*.iml
1010
/lib/codemirror.js
11+
/addon/runmode/runmode-standalone.js
12+
/addon/runmode/runmode.node.js
13+
**/.DS_Store

addon/runmode/runmode-standalone.js

Lines changed: 0 additions & 164 deletions
This file was deleted.

addon/runmode/runmode.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414
CodeMirror.runMode = function(string, modespec, callback, options) {
1515
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
16-
var ie = /MSIE \d/.test(navigator.userAgent);
17-
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
16+
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
1817

18+
// Create a tokenizing callback function if passed-in callback is a DOM element.
1919
if (callback.appendChild) {
20-
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
20+
var ie = /MSIE \d/.test(navigator.userAgent);
21+
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
2122
var node = callback, col = 0;
2223
node.innerHTML = "";
2324
callback = function(text, style) {
@@ -45,7 +46,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
4546
pos = idx + 1;
4647
}
4748
}
48-
49+
// Create a node with token style and append it to the callback DOM element.
4950
if (style) {
5051
var sp = node.appendChild(document.createElement("span"));
5152
sp.className = "cm-" + style.replace(/ +/g, " cm-");

addon/runmode/runmode.node.js

Lines changed: 0 additions & 197 deletions
This file was deleted.

0 commit comments

Comments
 (0)