Skip to content

Commit

Permalink
upgraded to CodeMirror 5.44.0
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed Feb 26, 2019
1 parent 78dfe73 commit 155f4a1
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 36 deletions.
10 changes: 10 additions & 0 deletions codemirror/js/addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@
var ranges = cm.listSelections(), replacements = [];
for (var i = 0; i < ranges.length; i++) {
var pos = ranges[i].head;

// If we're not in Markdown mode, fall back to normal newlineAndIndent
var eolState = cm.getStateAfter(pos.line);
var inner = cm.getMode().innerMode(eolState);
if (inner.mode.name !== "markdown") {
cm.execCommand("newlineAndIndent");
return;
} else {
eolState = inner.state;
}

var inList = eolState.list !== false;
var inQuote = eolState.quote !== 0;

Expand Down
4 changes: 2 additions & 2 deletions codemirror/js/addon/hint/show-hint.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

var mac = /Mac/.test(navigator.platform);

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
Expand Down Expand Up @@ -170,6 +168,8 @@ var mac = /Mac/.test(navigator.platform);
Esc: handle.close
};

var mac = /Mac/.test(navigator.platform);

if (mac) {
baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
Expand Down
28 changes: 18 additions & 10 deletions codemirror/js/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,6 @@
{ width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
}
var diff = cur.line.height - height;
if (height < 2) { height = textHeight(display); }
if (diff > .005 || diff < -.005) {
updateLineHeight(cur.line, height);
updateWidgetHeight(cur.line);
Expand Down Expand Up @@ -7840,7 +7839,7 @@
delayingBlurEvent: false,
focused: false,
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
selectingText: false,
draggingText: false,
highlight: new Delayed(), // stores highlight worker timeout
Expand Down Expand Up @@ -8073,7 +8072,8 @@
cm.display.shift = false;
if (!sel) { sel = doc.sel; }

var paste = cm.state.pasteIncoming || origin == "paste";
var recent = +new Date - 200;
var paste = origin == "paste" || cm.state.pasteIncoming > recent;
var textLines = splitLinesAuto(inserted), multiPaste = null;
// When pasting N lines into N selections, insert one line per selection
if (paste && sel.ranges.length > 1) {
Expand Down Expand Up @@ -8102,7 +8102,7 @@
{ from = to = Pos(from.line, 0); }
}
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
makeChange(cm.doc, changeEvent);
signalLater(cm, "inputRead", cm, changeEvent);
}
Expand All @@ -8112,7 +8112,7 @@
ensureCursorVisible(cm);
if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
cm.curOp.typing = true;
cm.state.pasteIncoming = cm.state.cutIncoming = false;
cm.state.pasteIncoming = cm.state.cutIncoming = -1;
}

function handlePaste(e, cm) {
Expand Down Expand Up @@ -9273,7 +9273,7 @@
on(te, "paste", function (e) {
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }

cm.state.pasteIncoming = true;
cm.state.pasteIncoming = +new Date;
input.fastPoll();
});

Expand All @@ -9294,15 +9294,23 @@
selectInput(te);
}
}
if (e.type == "cut") { cm.state.cutIncoming = true; }
if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
}
on(te, "cut", prepareCopyCut);
on(te, "copy", prepareCopyCut);

on(display.scroller, "paste", function (e) {
if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
cm.state.pasteIncoming = true;
input.focus();
if (!te.dispatchEvent) {
cm.state.pasteIncoming = +new Date;
input.focus();
return
}

// Pass the `paste` event to the textarea so it's handled by its event listener.
var event = new Event("paste");
event.clipboardData = e.clipboardData;
te.dispatchEvent(event);
});

// Prevent normal selection in the editor (we handle our own)
Expand Down Expand Up @@ -9725,7 +9733,7 @@

addLegacyProps(CodeMirror);

CodeMirror.version = "5.43.0";
CodeMirror.version = "5.44.0";

return CodeMirror;

Expand Down
2 changes: 1 addition & 1 deletion codemirror/js/codemirror.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.bbcodemixed.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions codemirror/js/codemirror.mode.htmlmixed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.javascript.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codemirror/js/codemirror.mode.php.min.js

Large diffs are not rendered by default.

25 changes: 10 additions & 15 deletions codemirror/js/mode/javascript/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cx.marked = "type"
return cont(afterType)
}
if (value == "|" || value == "&") return cont(typeexpr)
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)
Expand Down Expand Up @@ -680,25 +681,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function forspec(type, value) {
if (value == "await") return cont(forspec);
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
if (type == "(") return cont(pushlex(")"), forspec1, poplex);
}
function forspec1(type) {
if (type == "var") return cont(vardef, expect(";"), forspec2);
if (type == ";") return cont(forspec2);
if (type == "variable") return cont(formaybeinof);
return pass(expression, expect(";"), forspec2);
}
function formaybeinof(_type, value) {
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
return cont(maybeoperatorComma, forspec2);
if (type == "var") return cont(vardef, forspec2);
if (type == "variable") return cont(forspec2);
return pass(forspec2)
}
function forspec2(type, value) {
if (type == ";") return cont(forspec3);
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
return pass(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type != ")") cont(expression);
if (type == ")") return cont()
if (type == ";") return cont(forspec2)
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) }
return pass(expression, forspec2)
}
function functiondef(type, value) {
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
Expand All @@ -724,6 +718,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "@") cont(expression, funarg)
if (type == "spread") return cont(funarg);
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
if (isTS && type == "this") return cont(maybetype, maybeAssign)
return pass(pattern, maybetype, maybeAssign);
}
function classExpression(type, value) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
CKEDITOR.plugins.add("codemirror", {
icons: "searchcode,autoformat,commentselectedrange,uncommentselectedrange,autocomplete", // %REMOVE_LINE_CORE%
lang: "af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh", // %REMOVE_LINE_CORE%
version: "1.17.9",
version: "1.17.10",
init: function (editor) {
var rootPath = this.path,
defaultConfig = {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/theme/lesser-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Ported to CodeMirror by Peter Kroon
.cm-s-lesser-dark span.cm-tag { color: #669199; }
.cm-s-lesser-dark span.cm-attribute { color: #81a4d5; }
.cm-s-lesser-dark span.cm-hr { color: #999; }
.cm-s-lesser-dark span.cm-link { color: #00c; }
.cm-s-lesser-dark span.cm-link { color: #7070E6; }
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }

.cm-s-lesser-dark .CodeMirror-activeline-background { background: #3C3A3A; }
Expand Down
42 changes: 42 additions & 0 deletions codemirror/theme/nord.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Based on arcticicestudio's Nord theme */
/* https://github.com/arcticicestudio/nord */

.cm-s-nord.CodeMirror { background: #2e3440; color: #d8dee9; }
.cm-s-nord div.CodeMirror-selected { background: #434c5e; }
.cm-s-nord .CodeMirror-line::selection, .cm-s-nord .CodeMirror-line > span::selection, .cm-s-nord .CodeMirror-line > span > span::selection { background: #3b4252; }
.cm-s-nord .CodeMirror-line::-moz-selection, .cm-s-nord .CodeMirror-line > span::-moz-selection, .cm-s-nord .CodeMirror-line > span > span::-moz-selection { background: #3b4252; }
.cm-s-nord .CodeMirror-gutters { background: #2e3440; border-right: 0px; }
.cm-s-nord .CodeMirror-guttermarker { color: #4c566a; }
.cm-s-nord .CodeMirror-guttermarker-subtle { color: #4c566a; }
.cm-s-nord .CodeMirror-linenumber { color: #4c566a; }
.cm-s-nord .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }

.cm-s-nord span.cm-comment { color: #4c566a; }
.cm-s-nord span.cm-atom { color: #b48ead; }
.cm-s-nord span.cm-number { color: #b48ead; }

.cm-s-nord span.cm-comment.cm-attribute { color: #97b757; }
.cm-s-nord span.cm-comment.cm-def { color: #bc9262; }
.cm-s-nord span.cm-comment.cm-tag { color: #bc6283; }
.cm-s-nord span.cm-comment.cm-type { color: #5998a6; }

.cm-s-nord span.cm-property, .cm-s-nord span.cm-attribute { color: #8FBCBB; }
.cm-s-nord span.cm-keyword { color: #81A1C1; }
.cm-s-nord span.cm-builtin { color: #81A1C1; }
.cm-s-nord span.cm-string { color: #A3BE8C; }

.cm-s-nord span.cm-variable { color: #d8dee9; }
.cm-s-nord span.cm-variable-2 { color: #d8dee9; }
.cm-s-nord span.cm-variable-3, .cm-s-nord span.cm-type { color: #d8dee9; }
.cm-s-nord span.cm-def { color: #8FBCBB; }
.cm-s-nord span.cm-bracket { color: #81A1C1; }
.cm-s-nord span.cm-tag { color: #bf616a; }
.cm-s-nord span.cm-header { color: #b48ead; }
.cm-s-nord span.cm-link { color: #b48ead; }
.cm-s-nord span.cm-error { background: #bf616a; color: #f8f8f0; }

.cm-s-nord .CodeMirror-activeline-background { background: #3b4252; }
.cm-s-nord .CodeMirror-matchingbracket {
text-decoration: underline;
color: white !important;
}
2 changes: 1 addition & 1 deletion codemirror/theme/vibrant-ink.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
.cm-s-vibrant-ink .cm-link { color: blue; }
.cm-s-vibrant-ink .cm-link { color: #5656F3; }
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }

.cm-s-vibrant-ink .CodeMirror-activeline-background { background: #27282E; }
Expand Down

0 comments on commit 155f4a1

Please sign in to comment.