Remove $1
in CodeMirror$1
for development
This commit is contained in:
parent
eea72befb1
commit
e2b754bad6
|
@ -43,6 +43,12 @@ function isFolder(fileOrFolder) {
|
||||||
return stat.isDirectory();
|
return stat.isDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename CodeMirror$1 -> CodeMirror for development purposes
|
||||||
|
function renameCodeMirrorVariable(filePath) {
|
||||||
|
const file = fs.readFileSync(filePath, 'utf8');
|
||||||
|
fs.writeFileSync(filePath, file.replace(/CodeMirror\$1/g, 'CodeMirror'));
|
||||||
|
}
|
||||||
|
|
||||||
function updateExisting(lib) {
|
function updateExisting(lib) {
|
||||||
const libRoot = `${root}/node_modules/`;
|
const libRoot = `${root}/node_modules/`;
|
||||||
const vendorRoot = `${root}/vendor/`;
|
const vendorRoot = `${root}/vendor/`;
|
||||||
|
@ -54,8 +60,11 @@ function updateExisting(lib) {
|
||||||
const folderRoot = `${vendorRoot}${folder}`;
|
const folderRoot = `${vendorRoot}${folder}`;
|
||||||
const entries = fs.readdirSync(folderRoot);
|
const entries = fs.readdirSync(folderRoot);
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
|
// Remove $1 from "CodeMirror$1" in codemirror.js
|
||||||
|
if (entry === 'codemirror.js') {
|
||||||
|
renameCodeMirrorVariable(`${folderRoot}/${entry}`);
|
||||||
|
} else if (entry !== 'README.md' && entry !== 'LICENSE') {
|
||||||
// Ignore README.md & LICENSE files
|
// Ignore README.md & LICENSE files
|
||||||
if (entry !== 'README.md' && entry !== 'LICENSE') {
|
|
||||||
const entryPath = `${folderRoot}/${entry}`;
|
const entryPath = `${folderRoot}/${entry}`;
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(entryPath)) {
|
if (fs.existsSync(entryPath)) {
|
||||||
|
|
11
tools/zip.js
11
tools/zip.js
|
@ -8,9 +8,12 @@ function createZip() {
|
||||||
const fileName = 'stylus.zip';
|
const fileName = 'stylus.zip';
|
||||||
const exclude = [
|
const exclude = [
|
||||||
'.*', // dot files/folders (glob, not regexp)
|
'.*', // dot files/folders (glob, not regexp)
|
||||||
'node_modules',
|
'vendor/codemirror/lib/**', // get unmodified copy from node_modules
|
||||||
'tools',
|
'node_modules/**',
|
||||||
|
'tools/**',
|
||||||
'package.json',
|
'package.json',
|
||||||
|
'package-lock.json',
|
||||||
|
'yarn.lock',
|
||||||
'*.zip'
|
'*.zip'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -34,7 +37,9 @@ function createZip() {
|
||||||
});
|
});
|
||||||
|
|
||||||
archive.pipe(file);
|
archive.pipe(file);
|
||||||
archive.glob(`!(${exclude.join('|')})`);
|
archive.glob('**', {ignore: exclude});
|
||||||
|
// Don't use modified codemirror.js (see "update-libraries.js")
|
||||||
|
archive.directory('node_modules/codemirror/lib', 'vendor/codemirror/lib');
|
||||||
archive.finalize();
|
archive.finalize();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
48
vendor/codemirror/lib/codemirror.js
vendored
48
vendor/codemirror/lib/codemirror.js
vendored
|
@ -6408,7 +6408,7 @@ Doc.prototype = createObj(BranchChunk.prototype, {
|
||||||
unlinkDoc: function(other) {
|
unlinkDoc: function(other) {
|
||||||
var this$1 = this;
|
var this$1 = this;
|
||||||
|
|
||||||
if (other instanceof CodeMirror$1) { other = other.doc; }
|
if (other instanceof CodeMirror) { other = other.doc; }
|
||||||
if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
|
if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
|
||||||
var link = this$1.linked[i];
|
var link = this$1.linked[i];
|
||||||
if (link.doc != other) { continue }
|
if (link.doc != other) { continue }
|
||||||
|
@ -7773,10 +7773,10 @@ function wrappingChanged(cm) {
|
||||||
// A CodeMirror instance represents an editor. This is the object
|
// A CodeMirror instance represents an editor. This is the object
|
||||||
// that user code is usually dealing with.
|
// that user code is usually dealing with.
|
||||||
|
|
||||||
function CodeMirror$1(place, options) {
|
function CodeMirror(place, options) {
|
||||||
var this$1 = this;
|
var this$1 = this;
|
||||||
|
|
||||||
if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
|
if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
|
||||||
|
|
||||||
this.options = options = options ? copyObj(options) : {};
|
this.options = options = options ? copyObj(options) : {};
|
||||||
// Determine effective options based on given values and defaults.
|
// Determine effective options based on given values and defaults.
|
||||||
|
@ -7788,7 +7788,7 @@ function CodeMirror$1(place, options) {
|
||||||
else if (options.mode) { doc.modeOption = options.mode; }
|
else if (options.mode) { doc.modeOption = options.mode; }
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
|
|
||||||
var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
|
var input = new CodeMirror.inputStyles[options.inputStyle](this);
|
||||||
var display = this.display = new Display(place, doc, input);
|
var display = this.display = new Display(place, doc, input);
|
||||||
display.wrapper.CodeMirror = this;
|
display.wrapper.CodeMirror = this;
|
||||||
updateGutters(this);
|
updateGutters(this);
|
||||||
|
@ -7845,9 +7845,9 @@ function CodeMirror$1(place, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The default configuration options.
|
// The default configuration options.
|
||||||
CodeMirror$1.defaults = defaults;
|
CodeMirror.defaults = defaults;
|
||||||
// Functions to run when options are changed.
|
// Functions to run when options are changed.
|
||||||
CodeMirror$1.optionHandlers = optionHandlers;
|
CodeMirror.optionHandlers = optionHandlers;
|
||||||
|
|
||||||
// Attach the necessary event handlers when initializing the editor
|
// Attach the necessary event handlers when initializing the editor
|
||||||
function registerEventHandlers(cm) {
|
function registerEventHandlers(cm) {
|
||||||
|
@ -7958,7 +7958,7 @@ function registerEventHandlers(cm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var initHooks = [];
|
var initHooks = [];
|
||||||
CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
|
CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
|
||||||
|
|
||||||
// Indent the given line. The how parameter can be "smart",
|
// Indent the given line. The how parameter can be "smart",
|
||||||
// "add"/null, "subtract", or "prev". When aggressive is false
|
// "add"/null, "subtract", or "prev". When aggressive is false
|
||||||
|
@ -9592,7 +9592,7 @@ function fromTextArea(textarea, options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
textarea.style.display = "none";
|
textarea.style.display = "none";
|
||||||
var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
|
var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
|
||||||
options);
|
options);
|
||||||
return cm
|
return cm
|
||||||
}
|
}
|
||||||
|
@ -9643,14 +9643,14 @@ function addLegacyProps(CodeMirror) {
|
||||||
|
|
||||||
// EDITOR CONSTRUCTOR
|
// EDITOR CONSTRUCTOR
|
||||||
|
|
||||||
defineOptions(CodeMirror$1);
|
defineOptions(CodeMirror);
|
||||||
|
|
||||||
addEditorMethods(CodeMirror$1);
|
addEditorMethods(CodeMirror);
|
||||||
|
|
||||||
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
||||||
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
|
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
|
||||||
for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
||||||
{ CodeMirror$1.prototype[prop] = (function(method) {
|
{ CodeMirror.prototype[prop] = (function(method) {
|
||||||
return function() {return method.apply(this.doc, arguments)}
|
return function() {return method.apply(this.doc, arguments)}
|
||||||
})(Doc.prototype[prop]); } }
|
})(Doc.prototype[prop]); } }
|
||||||
|
|
||||||
|
@ -9658,39 +9658,39 @@ eventMixin(Doc);
|
||||||
|
|
||||||
// INPUT HANDLING
|
// INPUT HANDLING
|
||||||
|
|
||||||
CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
|
CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
|
||||||
|
|
||||||
// MODE DEFINITION AND QUERYING
|
// MODE DEFINITION AND QUERYING
|
||||||
|
|
||||||
// Extra arguments are stored as the mode's dependencies, which is
|
// Extra arguments are stored as the mode's dependencies, which is
|
||||||
// used by (legacy) mechanisms like loadmode.js to automatically
|
// used by (legacy) mechanisms like loadmode.js to automatically
|
||||||
// load a mode. (Preferred mechanism is the require/define calls.)
|
// load a mode. (Preferred mechanism is the require/define calls.)
|
||||||
CodeMirror$1.defineMode = function(name/*, mode, …*/) {
|
CodeMirror.defineMode = function(name/*, mode, …*/) {
|
||||||
if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
|
if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
|
||||||
defineMode.apply(this, arguments);
|
defineMode.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
CodeMirror$1.defineMIME = defineMIME;
|
CodeMirror.defineMIME = defineMIME;
|
||||||
|
|
||||||
// Minimal default mode.
|
// Minimal default mode.
|
||||||
CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
|
CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
|
||||||
CodeMirror$1.defineMIME("text/plain", "null");
|
CodeMirror.defineMIME("text/plain", "null");
|
||||||
|
|
||||||
// EXTENSIONS
|
// EXTENSIONS
|
||||||
|
|
||||||
CodeMirror$1.defineExtension = function (name, func) {
|
CodeMirror.defineExtension = function (name, func) {
|
||||||
CodeMirror$1.prototype[name] = func;
|
CodeMirror.prototype[name] = func;
|
||||||
};
|
};
|
||||||
CodeMirror$1.defineDocExtension = function (name, func) {
|
CodeMirror.defineDocExtension = function (name, func) {
|
||||||
Doc.prototype[name] = func;
|
Doc.prototype[name] = func;
|
||||||
};
|
};
|
||||||
|
|
||||||
CodeMirror$1.fromTextArea = fromTextArea;
|
CodeMirror.fromTextArea = fromTextArea;
|
||||||
|
|
||||||
addLegacyProps(CodeMirror$1);
|
addLegacyProps(CodeMirror);
|
||||||
|
|
||||||
CodeMirror$1.version = "5.39.2";
|
CodeMirror.version = "5.39.2";
|
||||||
|
|
||||||
return CodeMirror$1;
|
return CodeMirror;
|
||||||
|
|
||||||
})));
|
})));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user