Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
36c10e96f2
6
js/codemirror/addon/hint/sql-hint.js
vendored
6
js/codemirror/addon/hint/sql-hint.js
vendored
@ -127,13 +127,13 @@
|
||||
|
||||
if (columns) {
|
||||
addMatches(result, string, columns, function(w) {
|
||||
var tableInsert = table;
|
||||
if (alias == true) tableInsert = aliasTable;
|
||||
if (typeof w == "string") {
|
||||
var tableInsert = table;
|
||||
if (alias == true) tableInsert = aliasTable;
|
||||
w = tableInsert + "." + w;
|
||||
} else {
|
||||
w = shallowClone(w);
|
||||
w.text = table + "." + w.text;
|
||||
w.text = tableInsert + "." + w.text;
|
||||
}
|
||||
return useBacktick ? insertBackticks(w) : w;
|
||||
});
|
||||
|
||||
18
js/codemirror/lib/codemirror.css
vendored
18
js/codemirror/lib/codemirror.css
vendored
@ -92,6 +92,15 @@ div.CodeMirror-overwrite div.CodeMirror-cursor {}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
@ -111,18 +120,9 @@ div.CodeMirror-overwrite div.CodeMirror-cursor {}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
|
||||
62
js/codemirror/lib/codemirror.js
vendored
62
js/codemirror/lib/codemirror.js
vendored
@ -1081,9 +1081,10 @@
|
||||
cm.display.shift = false;
|
||||
if (!sel) sel = doc.sel;
|
||||
|
||||
var paste = cm.state.pasteIncoming || origin == "paste";
|
||||
var textLines = splitLines(inserted), multiPaste = null;
|
||||
// When pasing N lines into N selections, insert one line per selection
|
||||
if (cm.state.pasteIncoming && sel.ranges.length > 1) {
|
||||
if (paste && sel.ranges.length > 1) {
|
||||
if (lastCopied && lastCopied.join("\n") == inserted)
|
||||
multiPaste = sel.ranges.length % lastCopied.length == 0 && map(lastCopied, splitLines);
|
||||
else if (textLines.length == sel.ranges.length)
|
||||
@ -1097,16 +1098,16 @@
|
||||
if (range.empty()) {
|
||||
if (deleted && deleted > 0) // Handle deletion
|
||||
from = Pos(from.line, from.ch - deleted);
|
||||
else if (cm.state.overwrite && !cm.state.pasteIncoming) // Handle overwrite
|
||||
else if (cm.state.overwrite && !paste) // Handle overwrite
|
||||
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
|
||||
}
|
||||
var updateInput = cm.curOp.updateInput;
|
||||
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
|
||||
origin: origin || (cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
||||
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
||||
makeChange(cm.doc, changeEvent);
|
||||
signalLater(cm, "inputRead", cm, changeEvent);
|
||||
}
|
||||
if (inserted && !cm.state.pasteIncoming)
|
||||
if (inserted && !paste)
|
||||
triggerElectric(cm, inserted);
|
||||
|
||||
ensureCursorVisible(cm);
|
||||
@ -1115,6 +1116,15 @@
|
||||
cm.state.pasteIncoming = cm.state.cutIncoming = false;
|
||||
}
|
||||
|
||||
function handlePaste(e, cm) {
|
||||
var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
|
||||
if (pasted) {
|
||||
e.preventDefault();
|
||||
runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function triggerElectric(cm, inserted) {
|
||||
// When an 'electric' character is inserted, immediately trigger a reindent
|
||||
if (!cm.options.electricChars || !cm.options.smartIndent) return;
|
||||
@ -1211,21 +1221,9 @@
|
||||
input.poll();
|
||||
});
|
||||
|
||||
on(te, "paste", function() {
|
||||
// Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206
|
||||
// Add a char to the end of textarea before paste occur so that
|
||||
// selection doesn't span to the end of textarea.
|
||||
if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {
|
||||
var start = te.selectionStart, end = te.selectionEnd;
|
||||
te.value += "$";
|
||||
// The selection end needs to be set before the start, otherwise there
|
||||
// can be an intermediate non-empty selection between the two, which
|
||||
// can override the middle-click paste buffer on linux and cause the
|
||||
// wrong thing to get pasted.
|
||||
te.selectionEnd = end;
|
||||
te.selectionStart = start;
|
||||
cm.state.fakedLastChar = true;
|
||||
}
|
||||
on(te, "paste", function(e) {
|
||||
if (handlePaste(e, cm)) return true;
|
||||
|
||||
cm.state.pasteIncoming = true;
|
||||
input.fastPoll();
|
||||
});
|
||||
@ -1389,14 +1387,11 @@
|
||||
// possible when it is clear that nothing happened. hasSelection
|
||||
// will be the case when there is a lot of text in the textarea,
|
||||
// in which case reading its value would be expensive.
|
||||
if (!cm.state.focused || (hasSelection(input) && !prevInput) ||
|
||||
if (this.contextMenuPending || !cm.state.focused ||
|
||||
(hasSelection(input) && !prevInput) ||
|
||||
isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
|
||||
return false;
|
||||
// See paste handler for more on the fakedLastChar kludge
|
||||
if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
|
||||
input.value = input.value.substring(0, input.value.length - 1);
|
||||
cm.state.fakedLastChar = false;
|
||||
}
|
||||
|
||||
var text = input.value;
|
||||
// If nothing changed, bail.
|
||||
if (text == prevInput && !cm.somethingSelected()) return false;
|
||||
@ -1542,13 +1537,7 @@
|
||||
div.contentEditable = "true";
|
||||
disableBrowserMagic(div);
|
||||
|
||||
on(div, "paste", function(e) {
|
||||
var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
|
||||
if (pasted) {
|
||||
e.preventDefault();
|
||||
cm.replaceSelection(pasted, null, "paste");
|
||||
}
|
||||
});
|
||||
on(div, "paste", function(e) { handlePaste(e, cm); })
|
||||
|
||||
on(div, "compositionstart", function(e) {
|
||||
var data = e.data;
|
||||
@ -1761,7 +1750,7 @@
|
||||
var toIndex = findViewIndex(cm, to.line);
|
||||
if (toIndex == display.view.length - 1) {
|
||||
var toLine = display.viewTo - 1;
|
||||
var toNode = display.view[toIndex].node;
|
||||
var toNode = display.lineDiv.lastChild;
|
||||
} else {
|
||||
var toLine = lineNo(display.view[toIndex + 1].line) - 1;
|
||||
var toNode = display.view[toIndex + 1].node.previousSibling;
|
||||
@ -3567,7 +3556,8 @@
|
||||
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
|
||||
if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
|
||||
type == "single" && (contained = sel.contains(start)) > -1 &&
|
||||
!sel.ranges[contained].empty())
|
||||
(cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
|
||||
(cmp(contained.to(), start) > 0 || start.xRel < 0))
|
||||
leftButtonStartDrag(cm, e, start, modifier);
|
||||
else
|
||||
leftButtonSelect(cm, e, start, type, modifier);
|
||||
@ -7587,7 +7577,7 @@
|
||||
Doc.prototype.eachLine = Doc.prototype.iter;
|
||||
|
||||
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
||||
var dontDelegate = "iter insert remove copy getEditor".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)
|
||||
CodeMirror.prototype[prop] = (function(method) {
|
||||
return function() {return method.apply(this.doc, arguments);};
|
||||
@ -8739,7 +8729,7 @@
|
||||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "5.3.0";
|
||||
CodeMirror.version = "5.4.0";
|
||||
|
||||
return CodeMirror;
|
||||
});
|
||||
|
||||
7
js/codemirror/mode/javascript/javascript.js
vendored
7
js/codemirror/mode/javascript/javascript.js
vendored
@ -482,8 +482,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
function maybetype(type) {
|
||||
if (isTS && type == ":") return cont(typedef);
|
||||
}
|
||||
function maybedefault(_, value) {
|
||||
if (value == "=") return cont(expressionNoComma);
|
||||
}
|
||||
function typedef(type) {
|
||||
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
||||
if (type == "variable") {cx.marked = "variable-3"; return cont();}
|
||||
}
|
||||
function vardef() {
|
||||
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
||||
@ -538,7 +541,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
}
|
||||
function funarg(type) {
|
||||
if (type == "spread") return cont(funarg);
|
||||
return pass(pattern, maybetype);
|
||||
return pass(pattern, maybetype, maybedefault);
|
||||
}
|
||||
function className(type, value) {
|
||||
if (type == "variable") {register(value); return cont(classNameAfter);}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user