Skip to content

Commit 155f4a1

Browse files
committed
upgraded to CodeMirror 5.44.0
1 parent 78dfe73 commit 155f4a1

13 files changed

+91
-36
lines changed

codemirror/js/addon/edit/continuelist.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@
2020
var ranges = cm.listSelections(), replacements = [];
2121
for (var i = 0; i < ranges.length; i++) {
2222
var pos = ranges[i].head;
23+
24+
// If we're not in Markdown mode, fall back to normal newlineAndIndent
2325
var eolState = cm.getStateAfter(pos.line);
26+
var inner = cm.getMode().innerMode(eolState);
27+
if (inner.mode.name !== "markdown") {
28+
cm.execCommand("newlineAndIndent");
29+
return;
30+
} else {
31+
eolState = inner.state;
32+
}
33+
2434
var inList = eolState.list !== false;
2535
var inQuote = eolState.quote !== 0;
2636

codemirror/js/addon/hint/show-hint.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// CodeMirror, copyright (c) by Marijn Haverbeke and others
22
// Distributed under an MIT license: https://codemirror.net/LICENSE
33

4-
var mac = /Mac/.test(navigator.platform);
5-
64
(function(mod) {
75
if (typeof exports == "object" && typeof module == "object") // CommonJS
86
mod(require("../../lib/codemirror"));
@@ -170,6 +168,8 @@ var mac = /Mac/.test(navigator.platform);
170168
Esc: handle.close
171169
};
172170

171+
var mac = /Mac/.test(navigator.platform);
172+
173173
if (mac) {
174174
baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
175175
baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};

codemirror/js/codemirror.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,7 +3286,6 @@
32863286
{ width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
32873287
}
32883288
var diff = cur.line.height - height;
3289-
if (height < 2) { height = textHeight(display); }
32903289
if (diff > .005 || diff < -.005) {
32913290
updateLineHeight(cur.line, height);
32923291
updateWidgetHeight(cur.line);
@@ -7840,7 +7839,7 @@
78407839
delayingBlurEvent: false,
78417840
focused: false,
78427841
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
7843-
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
7842+
pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
78447843
selectingText: false,
78457844
draggingText: false,
78467845
highlight: new Delayed(), // stores highlight worker timeout
@@ -8073,7 +8072,8 @@
80738072
cm.display.shift = false;
80748073
if (!sel) { sel = doc.sel; }
80758074

8076-
var paste = cm.state.pasteIncoming || origin == "paste";
8075+
var recent = +new Date - 200;
8076+
var paste = origin == "paste" || cm.state.pasteIncoming > recent;
80778077
var textLines = splitLinesAuto(inserted), multiPaste = null;
80788078
// When pasting N lines into N selections, insert one line per selection
80798079
if (paste && sel.ranges.length > 1) {
@@ -8102,7 +8102,7 @@
81028102
{ from = to = Pos(from.line, 0); }
81038103
}
81048104
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
8105-
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
8105+
origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
81068106
makeChange(cm.doc, changeEvent);
81078107
signalLater(cm, "inputRead", cm, changeEvent);
81088108
}
@@ -8112,7 +8112,7 @@
81128112
ensureCursorVisible(cm);
81138113
if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
81148114
cm.curOp.typing = true;
8115-
cm.state.pasteIncoming = cm.state.cutIncoming = false;
8115+
cm.state.pasteIncoming = cm.state.cutIncoming = -1;
81168116
}
81178117

81188118
function handlePaste(e, cm) {
@@ -9273,7 +9273,7 @@
92739273
on(te, "paste", function (e) {
92749274
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
92759275

9276-
cm.state.pasteIncoming = true;
9276+
cm.state.pasteIncoming = +new Date;
92779277
input.fastPoll();
92789278
});
92799279

@@ -9294,15 +9294,23 @@
92949294
selectInput(te);
92959295
}
92969296
}
9297-
if (e.type == "cut") { cm.state.cutIncoming = true; }
9297+
if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
92989298
}
92999299
on(te, "cut", prepareCopyCut);
93009300
on(te, "copy", prepareCopyCut);
93019301

93029302
on(display.scroller, "paste", function (e) {
93039303
if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
9304-
cm.state.pasteIncoming = true;
9305-
input.focus();
9304+
if (!te.dispatchEvent) {
9305+
cm.state.pasteIncoming = +new Date;
9306+
input.focus();
9307+
return
9308+
}
9309+
9310+
// Pass the `paste` event to the textarea so it's handled by its event listener.
9311+
var event = new Event("paste");
9312+
event.clipboardData = e.clipboardData;
9313+
te.dispatchEvent(event);
93069314
});
93079315

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

97269734
addLegacyProps(CodeMirror);
97279735

9728-
CodeMirror.version = "5.43.0";
9736+
CodeMirror.version = "5.44.0";
97299737

97309738
return CodeMirror;
97319739

codemirror/js/codemirror.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codemirror/js/codemirror.mode.bbcodemixed.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codemirror/js/codemirror.mode.htmlmixed.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codemirror/js/codemirror.mode.javascript.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codemirror/js/codemirror.mode.php.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codemirror/js/mode/javascript/javascript.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
599599
cx.marked = "type"
600600
return cont(afterType)
601601
}
602+
if (value == "|" || value == "&") return cont(typeexpr)
602603
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
603604
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
604605
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
@@ -680,25 +681,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
680681
}
681682
function forspec(type, value) {
682683
if (value == "await") return cont(forspec);
683-
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
684+
if (type == "(") return cont(pushlex(")"), forspec1, poplex);
684685
}
685686
function forspec1(type) {
686-
if (type == "var") return cont(vardef, expect(";"), forspec2);
687-
if (type == ";") return cont(forspec2);
688-
if (type == "variable") return cont(formaybeinof);
689-
return pass(expression, expect(";"), forspec2);
690-
}
691-
function formaybeinof(_type, value) {
692-
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
693-
return cont(maybeoperatorComma, forspec2);
687+
if (type == "var") return cont(vardef, forspec2);
688+
if (type == "variable") return cont(forspec2);
689+
return pass(forspec2)
694690
}
695691
function forspec2(type, value) {
696-
if (type == ";") return cont(forspec3);
697-
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
698-
return pass(expression, expect(";"), forspec3);
699-
}
700-
function forspec3(type) {
701-
if (type != ")") cont(expression);
692+
if (type == ")") return cont()
693+
if (type == ";") return cont(forspec2)
694+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) }
695+
return pass(expression, forspec2)
702696
}
703697
function functiondef(type, value) {
704698
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
@@ -724,6 +718,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
724718
if (value == "@") cont(expression, funarg)
725719
if (type == "spread") return cont(funarg);
726720
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
721+
if (isTS && type == "this") return cont(maybetype, maybeAssign)
727722
return pass(pattern, maybetype, maybeAssign);
728723
}
729724
function classExpression(type, value) {

codemirror/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
CKEDITOR.plugins.add("codemirror", {
1111
icons: "searchcode,autoformat,commentselectedrange,uncommentselectedrange,autocomplete", // %REMOVE_LINE_CORE%
1212
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%
13-
version: "1.17.9",
13+
version: "1.17.10",
1414
init: function (editor) {
1515
var rootPath = this.path,
1616
defaultConfig = {

0 commit comments

Comments
 (0)