CodeMirror 5.60.0

This commit is contained in:
tophf 2021-03-20 14:23:49 +03:00
parent ed238183eb
commit 8c160ed40c
7 changed files with 28 additions and 20 deletions

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.5.17",
"license": "GPL-3.0-only",
"dependencies": {
"codemirror": "5.59.4",
"codemirror": "5.60.0",
"db-to-cloud": "^0.6.0",
"jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0",
@ -2361,9 +2361,9 @@
}
},
"node_modules/codemirror": {
"version": "5.59.4",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.4.tgz",
"integrity": "sha512-achw5JBgx8QPcACDDn+EUUXmCYzx/zxEtOGXyjvLEvYY8GleUrnfm5D+Zb+UjShHggXKDT9AXrbkBZX6a0YSQg=="
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.60.0.tgz",
"integrity": "sha512-AEL7LhFOlxPlCL8IdTcJDblJm8yrAGib7I+DErJPdZd4l6imx8IMgKK3RblVgBQqz3TZJR4oknQ03bz+uNjBYA=="
},
"node_modules/collection-visit": {
"version": "1.0.0",
@ -13933,9 +13933,9 @@
}
},
"codemirror": {
"version": "5.59.4",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.4.tgz",
"integrity": "sha512-achw5JBgx8QPcACDDn+EUUXmCYzx/zxEtOGXyjvLEvYY8GleUrnfm5D+Zb+UjShHggXKDT9AXrbkBZX6a0YSQg=="
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.60.0.tgz",
"integrity": "sha512-AEL7LhFOlxPlCL8IdTcJDblJm8yrAGib7I+DErJPdZd4l6imx8IMgKK3RblVgBQqz3TZJR4oknQ03bz+uNjBYA=="
},
"collection-visit": {
"version": "1.0.0",

View File

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

View File

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

View File

@ -360,7 +360,7 @@
close: function() {
if (this.completion.widget != this) return;
this.completion.widget = null;
this.hints.parentNode.removeChild(this.hints);
if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints);
this.completion.cm.removeKeyMap(this.keyMap);
var cm = this.completion.cm;

View File

@ -339,7 +339,7 @@
};
function sortLines(cm, caseSensitive) {
function sortLines(cm, caseSensitive, direction) {
if (cm.isReadOnly()) return CodeMirror.Pass
var ranges = cm.listSelections(), toSort = [], selected;
for (var i = 0; i < ranges.length; i++) {
@ -361,12 +361,12 @@
var start = Pos(from, 0), end = Pos(to);
var lines = cm.getRange(start, end, false);
if (caseSensitive)
lines.sort();
lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; });
else
lines.sort(function(a, b) {
var au = a.toUpperCase(), bu = b.toUpperCase();
if (au != bu) { a = au; b = bu; }
return a < b ? -1 : a == b ? 0 : 1;
return a < b ? -direction : a == b ? 0 : direction;
});
cm.replaceRange(lines, start, end);
if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)});
@ -375,8 +375,10 @@
});
}
cmds.sortLines = function(cm) { sortLines(cm, true); };
cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); };
cmds.sortLines = function(cm) { sortLines(cm, true, 1); };
cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); };
cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); };
cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); };
cmds.nextBookmark = function(cm) {
var marks = cm.state.sublimeBookmarks;
@ -609,7 +611,9 @@
"Cmd-J": "joinLines",
"Shift-Cmd-D": "duplicateLine",
"F5": "sortLines",
"Shift-F5": "reverseSortLines",
"Cmd-F5": "sortLinesInsensitive",
"Shift-Cmd-F5": "reverseSortLinesInsensitive",
"F2": "nextBookmark",
"Shift-F2": "prevBookmark",
"Cmd-F2": "toggleBookmark",
@ -671,7 +675,9 @@
"Ctrl-J": "joinLines",
"Shift-Ctrl-D": "duplicateLine",
"F9": "sortLines",
"Shift-F9": "reverseSortLines",
"Ctrl-F9": "sortLinesInsensitive",
"Shift-Ctrl-F9": "reverseSortLinesInsensitive",
"F2": "nextBookmark",
"Shift-F2": "prevBookmark",
"Ctrl-F2": "toggleBookmark",

View File

@ -6181,7 +6181,7 @@
var out = [];
for (var i = 0; i < ranges.length; i++)
{ out[i] = new Range(clipPos(this, ranges[i].anchor),
clipPos(this, ranges[i].head)); }
clipPos(this, ranges[i].head || ranges[i].anchor)); }
if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
setSelection(this, normalizeSelection(this.cm, out, primary), options);
}),
@ -8766,6 +8766,7 @@
var input = this, cm = input.cm;
var div = input.div = display.lineDiv;
div.contentEditable = true;
disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);
function belongsToInput(e) {
@ -9793,7 +9794,7 @@
addLegacyProps(CodeMirror);
CodeMirror.version = "5.59.3";
CodeMirror.version = "5.60.0";
return CodeMirror;

View File

@ -218,7 +218,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
// Parser
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true,
"regexp": true, "this": true, "import": true, "jsonld-keyword": true};
function JSLexical(indented, column, type, align, prev, info) {
this.indented = indented;
@ -441,7 +442,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
if (type == "quasi") return pass(quasi, maybeop);
if (type == "new") return cont(maybeTarget(noComma));
if (type == "import") return cont(expression);
return cont();
}
function maybeexpression(type) {
@ -605,7 +605,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
}
function typeexpr(type, value) {
if (value == "keyof" || value == "typeof" || value == "infer") {
if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") {
cx.marked = "keyword"
return cont(value == "typeof" ? expressionNoComma : typeexpr)
}
@ -802,6 +802,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function afterImport(type) {
if (type == "string") return cont();
if (type == "(") return pass(expression);
if (type == ".") return pass(maybeoperatorComma);
return pass(importSpec, maybeMoreImports, maybeFrom);
}
function importSpec(type, value) {