Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-05-03 02:12:40 +0300
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-05-03 02:12:40 +0300
commit393204ccd0a0c1e0083782fa73a3803150a6415b (patch)
treeabb562a8d06198ad66ae75dd6d1c746732bf2a93 /js
parentd98ff075db984a4165f7c3f29b71ebcac47c94b6 (diff)
Upgrade CodeMirror to v5.37.0
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'js')
-rw-r--r--js/vendor/codemirror/addon/hint/show-hint.js11
-rw-r--r--js/vendor/codemirror/addon/hint/sql-hint.js19
-rw-r--r--js/vendor/codemirror/lib/codemirror.js65
-rw-r--r--js/vendor/codemirror/mode/javascript/javascript.js26
-rw-r--r--js/vendor/codemirror/mode/sql/sql.js30
5 files changed, 92 insertions, 59 deletions
diff --git a/js/vendor/codemirror/addon/hint/show-hint.js b/js/vendor/codemirror/addon/hint/show-hint.js
index 62c683cb8c..81a63fc992 100644
--- a/js/vendor/codemirror/addon/hint/show-hint.js
+++ b/js/vendor/codemirror/addon/hint/show-hint.js
@@ -397,12 +397,13 @@
});
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
- var cur = cm.getCursor(), token = cm.getTokenAt(cur);
- var to = CodeMirror.Pos(cur.line, token.end);
- if (token.string && /\w/.test(token.string[token.string.length - 1])) {
- var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
+ var cur = cm.getCursor(), token = cm.getTokenAt(cur)
+ var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
+ if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
+ term = token.string.substr(0, cur.ch - token.start)
} else {
- var term = "", from = to;
+ term = ""
+ from = cur
}
var found = [];
for (var i = 0; i < options.words.length; i++) {
diff --git a/js/vendor/codemirror/addon/hint/sql-hint.js b/js/vendor/codemirror/addon/hint/sql-hint.js
index 5d20eea625..62b69c948f 100644
--- a/js/vendor/codemirror/addon/hint/sql-hint.js
+++ b/js/vendor/codemirror/addon/hint/sql-hint.js
@@ -275,10 +275,23 @@
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
start = nameCompletion(cur, token, result, editor);
} else {
- addMatches(result, search, defaultTable, function(w) {return w;});
- addMatches(result, search, tables, function(w) {return w;});
+ addMatches(result, search, defaultTable, function(w) {return {text:w, className: "CodeMirror-hint-table CodeMirror-hint-default-table"};});
+ addMatches(
+ result,
+ search,
+ tables,
+ function(w) {
+ if (typeof w === 'object') {
+ w.className = "CodeMirror-hint-table";
+ } else {
+ w = {text: w, className: "CodeMirror-hint-table"};
+ }
+
+ return w;
+ }
+ );
if (!disableKeywords)
- addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
+ addMatches(result, search, keywords, function(w) {return {text: w.toUpperCase(), className: "CodeMirror-hint-keyword"};});
}
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
diff --git a/js/vendor/codemirror/lib/codemirror.js b/js/vendor/codemirror/lib/codemirror.js
index fb376526e1..14e4bdebfd 100644
--- a/js/vendor/codemirror/lib/codemirror.js
+++ b/js/vendor/codemirror/lib/codemirror.js
@@ -4796,7 +4796,7 @@ function addChangeToHistory(doc, change, selAfter, opId) {
if ((hist.lastOp == opId ||
hist.lastOrigin == change.origin && change.origin &&
- ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
+ ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
change.origin.charAt(0) == "*")) &&
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
// Merge this change into the last event
@@ -5410,7 +5410,7 @@ function makeChangeSingleDocInEditor(cm, change, spans) {
function replaceRange(doc, code, from, to, origin) {
if (!to) { to = from; }
if (cmp(to, from) < 0) { var assign;
- (assign = [to, from], from = assign[0], to = assign[1], assign); }
+ (assign = [to, from], from = assign[0], to = assign[1]); }
if (typeof code == "string") { code = doc.splitLines(code); }
makeChange(doc, {from: from, to: to, text: code, origin: origin});
}
@@ -5506,10 +5506,10 @@ function LeafChunk(lines) {
}
LeafChunk.prototype = {
- chunkSize: function chunkSize() { return this.lines.length },
+ chunkSize: function() { return this.lines.length },
// Remove the n lines at offset 'at'.
- removeInner: function removeInner(at, n) {
+ removeInner: function(at, n) {
var this$1 = this;
for (var i = at, e = at + n; i < e; ++i) {
@@ -5522,13 +5522,13 @@ LeafChunk.prototype = {
},
// Helper used to collapse a small branch into a single leaf.
- collapse: function collapse(lines) {
+ collapse: function(lines) {
lines.push.apply(lines, this.lines);
},
// Insert the given array of lines at offset 'at', count them as
// having the given height.
- insertInner: function insertInner(at, lines, height) {
+ insertInner: function(at, lines, height) {
var this$1 = this;
this.height += height;
@@ -5537,7 +5537,7 @@ LeafChunk.prototype = {
},
// Used to iterate over a part of the tree.
- iterN: function iterN(at, n, op) {
+ iterN: function(at, n, op) {
var this$1 = this;
for (var e = at + n; at < e; ++at)
@@ -5561,9 +5561,9 @@ function BranchChunk(children) {
}
BranchChunk.prototype = {
- chunkSize: function chunkSize() { return this.size },
+ chunkSize: function() { return this.size },
- removeInner: function removeInner(at, n) {
+ removeInner: function(at, n) {
var this$1 = this;
this.size -= n;
@@ -5589,13 +5589,13 @@ BranchChunk.prototype = {
}
},
- collapse: function collapse(lines) {
+ collapse: function(lines) {
var this$1 = this;
for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
},
- insertInner: function insertInner(at, lines, height) {
+ insertInner: function(at, lines, height) {
var this$1 = this;
this.size += lines.length;
@@ -5624,7 +5624,7 @@ BranchChunk.prototype = {
},
// When a node has grown, check whether it should be split.
- maybeSpill: function maybeSpill() {
+ maybeSpill: function() {
if (this.children.length <= 10) { return }
var me = this;
do {
@@ -5646,7 +5646,7 @@ BranchChunk.prototype = {
me.parent.maybeSpill();
},
- iterN: function iterN(at, n, op) {
+ iterN: function(at, n, op) {
var this$1 = this;
for (var i = 0; i < this.children.length; ++i) {
@@ -7324,8 +7324,8 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
var dragEnd = operation(cm, function (e) {
if (webkit) { display.scroller.draggable = false; }
cm.state.draggingText = false;
- off(document, "mouseup", dragEnd);
- off(document, "mousemove", mouseMove);
+ off(display.wrapper.ownerDocument, "mouseup", dragEnd);
+ off(display.wrapper.ownerDocument, "mousemove", mouseMove);
off(display.scroller, "dragstart", dragStart);
off(display.scroller, "drop", dragEnd);
if (!moved) {
@@ -7334,7 +7334,7 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
{ extendSelection(cm.doc, pos, null, null, behavior.extend); }
// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
if (webkit || ie && ie_version == 9)
- { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
+ { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }
else
{ display.input.focus(); }
}
@@ -7349,8 +7349,8 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
dragEnd.copy = !behavior.moveOnDrag;
// IE's approach to draggable
if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
- on(document, "mouseup", dragEnd);
- on(document, "mousemove", mouseMove);
+ on(display.wrapper.ownerDocument, "mouseup", dragEnd);
+ on(display.wrapper.ownerDocument, "mousemove", mouseMove);
on(display.scroller, "dragstart", dragStart);
on(display.scroller, "drop", dragEnd);
@@ -7482,8 +7482,8 @@ function leftButtonSelect(cm, event, start, behavior) {
counter = Infinity;
e_preventDefault(e);
display.input.focus();
- off(document, "mousemove", move);
- off(document, "mouseup", up);
+ off(display.wrapper.ownerDocument, "mousemove", move);
+ off(display.wrapper.ownerDocument, "mouseup", up);
doc.history.lastSelOrigin = null;
}
@@ -7493,8 +7493,8 @@ function leftButtonSelect(cm, event, start, behavior) {
});
var up = operation(cm, done);
cm.state.selectingText = up;
- on(document, "mousemove", move);
- on(document, "mouseup", up);
+ on(display.wrapper.ownerDocument, "mousemove", move);
+ on(display.wrapper.ownerDocument, "mouseup", up);
}
// Used when mouse-selecting to adjust the anchor to the proper side
@@ -9017,7 +9017,7 @@ ContentEditableInput.prototype.setUneditable = function (node) {
};
ContentEditableInput.prototype.onKeyPress = function (e) {
- if (e.charCode == 0) { return }
+ if (e.charCode == 0 || this.composing) { return }
e.preventDefault();
if (!this.cm.isReadOnly())
{ operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
@@ -9199,13 +9199,10 @@ TextareaInput.prototype.init = function (display) {
var this$1 = this;
var input = this, cm = this.cm;
+ this.createField(display);
+ var te = this.textarea;
- // Wraps and hides input textarea
- var div = this.wrapper = hiddenTextarea();
- // The semihidden textarea that is focused when the editor is
- // focused, and receives input.
- var te = this.textarea = div.firstChild;
- display.wrapper.insertBefore(div, display.wrapper.firstChild);
+ display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
if (ios) { te.style.width = "0px"; }
@@ -9272,6 +9269,14 @@ TextareaInput.prototype.init = function (display) {
});
};
+TextareaInput.prototype.createField = function (_display) {
+ // Wraps and hides input textarea
+ this.wrapper = hiddenTextarea();
+ // The semihidden textarea that is focused when the editor is
+ // focused, and receives input.
+ this.textarea = this.wrapper.firstChild;
+};
+
TextareaInput.prototype.prepareSelection = function () {
// Redraw the selection and/or cursor
var cm = this.cm, display = cm.display, doc = cm.doc;
@@ -9665,7 +9670,7 @@ CodeMirror$1.fromTextArea = fromTextArea;
addLegacyProps(CodeMirror$1);
-CodeMirror$1.version = "5.35.0";
+CodeMirror$1.version = "5.37.0";
return CodeMirror$1;
diff --git a/js/vendor/codemirror/mode/javascript/javascript.js b/js/vendor/codemirror/mode/javascript/javascript.js
index 52da9e2353..c4a709c624 100644
--- a/js/vendor/codemirror/mode/javascript/javascript.js
+++ b/js/vendor/codemirror/mode/javascript/javascript.js
@@ -126,7 +126,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var kw = keywords[word]
return ret(kw.type, kw.style, word)
}
- if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\(\w]/, false))
+ if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
return ret("async", "keyword", word)
}
return ret("variable", "variable", word)
@@ -356,6 +356,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} else if (isTS && value == "namespace") {
cx.marked = "keyword"
return cont(pushlex("form"), expression, block, poplex)
+ } else if (isTS && value == "abstract") {
+ cx.marked = "keyword"
+ return cont(statement)
} else {
return cont(pushlex("stat"), maybelabel);
}
@@ -560,19 +563,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
}
function typeexpr(type, value) {
+ if (value == "keyof" || value == "typeof") {
+ cx.marked = "keyword"
+ return cont(value == "keyof" ? typeexpr : expressionNoComma)
+ }
if (type == "variable" || value == "void") {
- if (value == "keyof") {
- cx.marked = "keyword"
- return cont(typeexpr)
- } else {
- cx.marked = "type"
- return cont(afterType)
- }
+ cx.marked = "type"
+ return cont(afterType)
}
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
+ if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
}
function maybeReturnType(type) {
if (type == "=>") return cont(typeexpr)
@@ -589,9 +592,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(expression, maybetype, expect("]"), typeprop)
}
}
- function typearg(type) {
- if (type == "variable") return cont(typearg)
- else if (type == ":") return cont(typeexpr)
+ function typearg(type, value) {
+ if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
+ if (type == ":") return cont(typeexpr)
+ return pass(typeexpr)
}
function afterType(type, value) {
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
diff --git a/js/vendor/codemirror/mode/sql/sql.js b/js/vendor/codemirror/mode/sql/sql.js
index 2010b1c250..fddbabae80 100644
--- a/js/vendor/codemirror/mode/sql/sql.js
+++ b/js/vendor/codemirror/mode/sql/sql.js
@@ -22,7 +22,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
support = parserConfig.support || {},
hooks = parserConfig.hooks || {},
dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true},
- backslashStringEscapes = parserConfig.backslashStringEscapes !== false
+ backslashStringEscapes = parserConfig.backslashStringEscapes !== false,
+ brackets = parserConfig.brackets || /^[\{}\(\)\[\]]/,
+ punctuation = parserConfig.punctuation || /^[;.,:]/
function tokenBase(stream, state) {
var ch = stream.next();
@@ -65,9 +67,6 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// charset casting: _utf8'str', N'str', n'str'
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
return "keyword";
- } else if (/^[\(\),\;\[\]]/.test(ch)) {
- // no highlighting
- return null;
} else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
// 1-line comment
stream.skipToEnd();
@@ -96,7 +95,15 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
} else if (operatorChars.test(ch)) {
// operators
stream.eatWhile(operatorChars);
- return null;
+ return "operator";
+ } else if (brackets.test(ch)) {
+ // brackets
+ stream.eatWhile(brackets);
+ return "bracket";
+ } else if (punctuation.test(ch)) {
+ // punctuation
+ stream.eatWhile(punctuation);
+ return "punctuation";
} else if (ch == '{' &&
(stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) {
// dates (weird ODBC syntax)
@@ -194,7 +201,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
blockCommentStart: "/*",
blockCommentEnd: "*/",
- lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--"
+ lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--",
+ closeBrackets: "()[]{}''\"\"``"
};
});
@@ -288,11 +296,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
CodeMirror.defineMIME("text/x-mssql", {
name: "sql",
- client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
- keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec"),
+ client: set("$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id"),
+ keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with"),
builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
+ atoms: set("is not null like and or in left right between inner outer join all any some cross unpivot pivot exists"),
+ operatorChars: /^[*+\-%<>!=^\&|\/]/,
+ brackets: /^[\{}\(\)]/,
+ punctuation: /^[;.,:/]/,
backslashStringEscapes: false,
dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"),
hooks: {