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

View File

@ -6,7 +6,7 @@
"repository": "openstyles/stylus", "repository": "openstyles/stylus",
"author": "Stylus Team", "author": "Stylus Team",
"dependencies": { "dependencies": {
"codemirror": "5.59.4", "codemirror": "5.60.0",
"db-to-cloud": "^0.6.0", "db-to-cloud": "^0.6.0",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"less-bundle": "github:openstyles/less-bundle#v0.1.0", "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): Following files are copied from npm (node_modules):

View File

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

View File

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

View File

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