Skip to content

Commit

Permalink
[runmode addon] Reuse existing support code for standalone/node versi…
Browse files Browse the repository at this point in the history
…ons of runmode
  • Loading branch information
BrianHung committed Jun 18, 2020
1 parent 215c1dc commit 001e07f
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 385 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
.idea
*.iml
/lib/codemirror.js
/addon/runmode/runmode-standalone.js
/addon/runmode/runmode.node.js
**/.DS_Store
164 changes: 0 additions & 164 deletions addon/runmode/runmode-standalone.js

This file was deleted.

9 changes: 5 additions & 4 deletions addon/runmode/runmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

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

// Create a tokenizing callback function if passed-in callback is a DOM element.
if (callback.appendChild) {
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
var node = callback, col = 0;
node.innerHTML = "";
callback = function(text, style) {
Expand Down Expand Up @@ -45,7 +46,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
pos = idx + 1;
}
}

// Create a node with token style and append it to the callback DOM element.
if (style) {
var sp = node.appendChild(document.createElement("span"));
sp.className = "cm-" + style.replace(/ +/g, " cm-");
Expand Down
197 changes: 0 additions & 197 deletions addon/runmode/runmode.node.js

This file was deleted.

0 comments on commit 001e07f

Please sign in to comment.