Skip to content
Snippets Groups Projects
Commit d47bae43 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[runmode.node addon] Include null mode

parent 70b72c7f
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,12 @@ exports.defineMode = function(name, mode) { ...@@ -68,6 +68,12 @@ exports.defineMode = function(name, mode) {
modes[name] = mode; modes[name] = mode;
}; };
exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; }; exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
exports.defineMode("null", function() {
return {token: function(stream) {stream.skipToEnd();}};
});
exports.defineMIME("text/plain", "null");
exports.getMode = function(options, spec) { exports.getMode = function(options, spec) {
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
spec = mimeModes[spec]; spec = mimeModes[spec];
......
...@@ -27,7 +27,7 @@ CodeMirror.modeInfo.forEach(function(info) { ...@@ -27,7 +27,7 @@ CodeMirror.modeInfo.forEach(function(info) {
}); });
function ensureMode(name) { function ensureMode(name) {
if (CodeMirror.modes[name]) return; if (CodeMirror.modes[name] || name == "null") return;
try { try {
require("../mode/" + name + "/" + name + ".js"); require("../mode/" + name + "/" + name + ".js");
} catch(e) { } catch(e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment