revert CodeMirror to 5.59.0

5.59.1 is bugged https://github.com/codemirror/CodeMirror/issues/6558
This commit is contained in:
tophf 2021-01-10 13:02:20 +03:00
parent fe176c9b62
commit b00e6d23fe
6 changed files with 23 additions and 39 deletions

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.5.14",
"license": "GPL-3.0-only",
"dependencies": {
"codemirror": "^5.59.1",
"codemirror": "5.59.0",
"db-to-cloud": "^0.4.5",
"jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0",
@ -2364,9 +2364,9 @@
}
},
"node_modules/codemirror": {
"version": "5.59.1",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.1.tgz",
"integrity": "sha512-d0SSW/PCCD4LoSCBPdnP0BzmZB1v3emomCUtVlIWgZHJ06yVeBOvBtOH7vYz707pfAvEeWbO9aP6akh8vl1V3w=="
"version": "5.59.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.0.tgz",
"integrity": "sha512-UGzSkCacY9z0rSpQ3wnTWRN2nvRE6foDXnJltWW8pazInR/R+3gXHrao4IFQMv/bSBvFBxt8/HPpkpKAS54x5Q=="
},
"node_modules/collection-visit": {
"version": "1.0.0",
@ -13958,9 +13958,9 @@
}
},
"codemirror": {
"version": "5.59.1",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.1.tgz",
"integrity": "sha512-d0SSW/PCCD4LoSCBPdnP0BzmZB1v3emomCUtVlIWgZHJ06yVeBOvBtOH7vYz707pfAvEeWbO9aP6akh8vl1V3w=="
"version": "5.59.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.0.tgz",
"integrity": "sha512-UGzSkCacY9z0rSpQ3wnTWRN2nvRE6foDXnJltWW8pazInR/R+3gXHrao4IFQMv/bSBvFBxt8/HPpkpKAS54x5Q=="
},
"collection-visit": {
"version": "1.0.0",

View File

@ -6,7 +6,7 @@
"repository": "openstyles/stylus",
"author": "Stylus Team",
"dependencies": {
"codemirror": "^5.59.1",
"codemirror": "5.59.0",
"db-to-cloud": "^0.4.5",
"jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0",

View File

@ -1,4 +1,4 @@
## codemirror v5.59.1
## codemirror v5.59.0
Following files are copied from npm (node_modules):

View File

@ -87,7 +87,7 @@
cm.operation(function() {
var linesep = cm.lineSeparator() || "\n";
cm.replaceSelection(linesep + linesep, null);
moveSel(cm, -1)
cm.execCommand("goCharLeft");
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var line = ranges[i].head.line;
@ -97,17 +97,6 @@
});
}
function moveSel(cm, dir) {
var newRanges = [], ranges = cm.listSelections(), primary = 0
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i]
if (range.head == cm.getCursor()) primary = i
var pos = {line: range.head.line, ch: range.head.ch + dir}
newRanges.push({anchor: pos, head: pos})
}
cm.setSelections(newRanges, primary)
}
function contractSelection(sel) {
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
@ -164,9 +153,10 @@
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
cm.operation(function() {
if (type == "skip") {
moveSel(cm, 1)
cm.execCommand("goCharRight");
} else if (type == "skipThree") {
moveSel(cm, 3)
for (var i = 0; i < 3; i++)
cm.execCommand("goCharRight");
} else if (type == "surround") {
var sels = cm.getSelections();
for (var i = 0; i < sels.length; i++)
@ -179,10 +169,10 @@
} else if (type == "both") {
cm.replaceSelection(left + right, null);
cm.triggerElectric(left + right);
moveSel(cm, -1)
cm.execCommand("goCharLeft");
} else if (type == "addFour") {
cm.replaceSelection(left + left + left + left, "before");
moveSel(cm, 1)
cm.execCommand("goCharRight");
}
});
}

View File

@ -32,7 +32,7 @@
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
var phantom = /PhantomJS/.test(userAgent);
var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
var ios = !edge && /AppleWebKit/.test(userAgent) && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
var android = /Android/.test(userAgent);
// This is woefully incomplete. Suggestions for alternative methods welcome.
var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
@ -8676,12 +8676,9 @@
var next;
if (unit == "codepoint") {
var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));
if (isNaN(ch)) {
next = null;
} else {
var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;
next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);
}
if (isNaN(ch)) { next = null; }
else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),
-dir); }
} else if (visually) {
next = moveVisually(doc.cm, lineObj, pos, dir);
} else {
@ -9793,7 +9790,7 @@
addLegacyProps(CodeMirror);
CodeMirror.version = "5.59.1";
CodeMirror.version = "5.59.0";
return CodeMirror;

View File

@ -640,8 +640,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
} else if (type == "(") {
return pass(functiondecl, typeprop)
} else if (!type.match(/[;\}\)\],]/)) {
return cont()
}
}
function typearg(type, value) {
@ -934,7 +932,6 @@ CodeMirror.defineMIME("application/x-javascript", "javascript");
CodeMirror.defineMIME("application/ecmascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true })
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });