@hpcc-js/codemirror 2.60.13 → 2.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +66 -36
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +66 -36
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/Editor.ts +30 -7
- package/src/__package__.ts +2 -2
- package/types/Editor.d.ts +6 -0
- package/types/Editor.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- package/types/__package__.d.ts.map +1 -1
- package/types-3.4/Editor.d.ts +6 -0
- package/types-3.4/__package__.d.ts +2 -2
package/dist/index.es6.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Palette, HTMLWidget } from '@hpcc-js/common';
|
|
2
2
|
|
|
3
3
|
var PKG_NAME = "@hpcc-js/codemirror";
|
|
4
|
-
var PKG_VERSION = "2.
|
|
5
|
-
var BUILD_VERSION = "2.104.
|
|
4
|
+
var PKG_VERSION = "2.61.1";
|
|
5
|
+
var BUILD_VERSION = "2.104.35";
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -169,13 +169,14 @@ var codemirror = {exports: {}};
|
|
|
169
169
|
} while (child = child.parentNode)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
function activeElt(
|
|
172
|
+
function activeElt(rootNode) {
|
|
173
173
|
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
|
|
174
174
|
// IE < 10 will throw when accessed while the page is loading or in an iframe.
|
|
175
175
|
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
|
|
176
|
+
var doc = rootNode.ownerDocument || rootNode;
|
|
176
177
|
var activeElement;
|
|
177
178
|
try {
|
|
178
|
-
activeElement =
|
|
179
|
+
activeElement = rootNode.activeElement;
|
|
179
180
|
} catch(e) {
|
|
180
181
|
activeElement = doc.body || null;
|
|
181
182
|
}
|
|
@@ -203,6 +204,15 @@ var codemirror = {exports: {}};
|
|
|
203
204
|
|
|
204
205
|
function doc(cm) { return cm.display.wrapper.ownerDocument }
|
|
205
206
|
|
|
207
|
+
function root(cm) {
|
|
208
|
+
return rootNode(cm.display.wrapper)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function rootNode(element) {
|
|
212
|
+
// Detect modern browsers (2017+).
|
|
213
|
+
return element.getRootNode ? element.getRootNode() : element.ownerDocument
|
|
214
|
+
}
|
|
215
|
+
|
|
206
216
|
function win(cm) { return doc(cm).defaultView }
|
|
207
217
|
|
|
208
218
|
function bind(f) {
|
|
@@ -3957,7 +3967,7 @@ var codemirror = {exports: {}};
|
|
|
3957
3967
|
cm.display.maxLineChanged = false;
|
|
3958
3968
|
}
|
|
3959
3969
|
|
|
3960
|
-
var takeFocus = op.focus && op.focus == activeElt(
|
|
3970
|
+
var takeFocus = op.focus && op.focus == activeElt(root(cm));
|
|
3961
3971
|
if (op.preparedSelection)
|
|
3962
3972
|
{ cm.display.input.showSelection(op.preparedSelection, takeFocus); }
|
|
3963
3973
|
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
|
@@ -4134,7 +4144,7 @@ var codemirror = {exports: {}};
|
|
|
4134
4144
|
|
|
4135
4145
|
function selectionSnapshot(cm) {
|
|
4136
4146
|
if (cm.hasFocus()) { return null }
|
|
4137
|
-
var active = activeElt(
|
|
4147
|
+
var active = activeElt(root(cm));
|
|
4138
4148
|
if (!active || !contains(cm.display.lineDiv, active)) { return null }
|
|
4139
4149
|
var result = {activeElt: active};
|
|
4140
4150
|
if (window.getSelection) {
|
|
@@ -4150,7 +4160,7 @@ var codemirror = {exports: {}};
|
|
|
4150
4160
|
}
|
|
4151
4161
|
|
|
4152
4162
|
function restoreSelection(snapshot) {
|
|
4153
|
-
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(snapshot.activeElt
|
|
4163
|
+
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(rootNode(snapshot.activeElt))) { return }
|
|
4154
4164
|
snapshot.activeElt.focus();
|
|
4155
4165
|
if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
|
|
4156
4166
|
snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
|
|
@@ -7321,7 +7331,7 @@ var codemirror = {exports: {}};
|
|
|
7321
7331
|
function onKeyDown(e) {
|
|
7322
7332
|
var cm = this;
|
|
7323
7333
|
if (e.target && e.target != cm.display.input.getField()) { return }
|
|
7324
|
-
cm.curOp.focus = activeElt(
|
|
7334
|
+
cm.curOp.focus = activeElt(root(cm));
|
|
7325
7335
|
if (signalDOMEvent(cm, e)) { return }
|
|
7326
7336
|
// IE does strange things with escape.
|
|
7327
7337
|
if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
|
|
@@ -7483,7 +7493,7 @@ var codemirror = {exports: {}};
|
|
|
7483
7493
|
|
|
7484
7494
|
function leftButtonDown(cm, pos, repeat, event) {
|
|
7485
7495
|
if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
|
|
7486
|
-
else { cm.curOp.focus = activeElt(
|
|
7496
|
+
else { cm.curOp.focus = activeElt(root(cm)); }
|
|
7487
7497
|
|
|
7488
7498
|
var behavior = configureMouse(cm, repeat, event);
|
|
7489
7499
|
|
|
@@ -7553,19 +7563,19 @@ var codemirror = {exports: {}};
|
|
|
7553
7563
|
// Normal selection, as opposed to text dragging.
|
|
7554
7564
|
function leftButtonSelect(cm, event, start, behavior) {
|
|
7555
7565
|
if (ie) { delayBlurEvent(cm); }
|
|
7556
|
-
var display = cm.display, doc
|
|
7566
|
+
var display = cm.display, doc = cm.doc;
|
|
7557
7567
|
e_preventDefault(event);
|
|
7558
7568
|
|
|
7559
|
-
var ourRange, ourIndex, startSel = doc
|
|
7569
|
+
var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
|
|
7560
7570
|
if (behavior.addNew && !behavior.extend) {
|
|
7561
|
-
ourIndex = doc
|
|
7571
|
+
ourIndex = doc.sel.contains(start);
|
|
7562
7572
|
if (ourIndex > -1)
|
|
7563
7573
|
{ ourRange = ranges[ourIndex]; }
|
|
7564
7574
|
else
|
|
7565
7575
|
{ ourRange = new Range(start, start); }
|
|
7566
7576
|
} else {
|
|
7567
|
-
ourRange = doc
|
|
7568
|
-
ourIndex = doc
|
|
7577
|
+
ourRange = doc.sel.primary();
|
|
7578
|
+
ourIndex = doc.sel.primIndex;
|
|
7569
7579
|
}
|
|
7570
7580
|
|
|
7571
7581
|
if (behavior.unit == "rectangle") {
|
|
@@ -7582,18 +7592,18 @@ var codemirror = {exports: {}};
|
|
|
7582
7592
|
|
|
7583
7593
|
if (!behavior.addNew) {
|
|
7584
7594
|
ourIndex = 0;
|
|
7585
|
-
setSelection(doc
|
|
7586
|
-
startSel = doc
|
|
7595
|
+
setSelection(doc, new Selection([ourRange], 0), sel_mouse);
|
|
7596
|
+
startSel = doc.sel;
|
|
7587
7597
|
} else if (ourIndex == -1) {
|
|
7588
7598
|
ourIndex = ranges.length;
|
|
7589
|
-
setSelection(doc
|
|
7599
|
+
setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
|
|
7590
7600
|
{scroll: false, origin: "*mouse"});
|
|
7591
7601
|
} else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
|
|
7592
|
-
setSelection(doc
|
|
7602
|
+
setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
|
|
7593
7603
|
{scroll: false, origin: "*mouse"});
|
|
7594
|
-
startSel = doc
|
|
7604
|
+
startSel = doc.sel;
|
|
7595
7605
|
} else {
|
|
7596
|
-
replaceOneSelection(doc
|
|
7606
|
+
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
|
|
7597
7607
|
}
|
|
7598
7608
|
|
|
7599
7609
|
var lastPos = start;
|
|
@@ -7603,19 +7613,19 @@ var codemirror = {exports: {}};
|
|
|
7603
7613
|
|
|
7604
7614
|
if (behavior.unit == "rectangle") {
|
|
7605
7615
|
var ranges = [], tabSize = cm.options.tabSize;
|
|
7606
|
-
var startCol = countColumn(getLine(doc
|
|
7607
|
-
var posCol = countColumn(getLine(doc
|
|
7616
|
+
var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
|
|
7617
|
+
var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
|
|
7608
7618
|
var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
|
|
7609
7619
|
for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
|
|
7610
7620
|
line <= end; line++) {
|
|
7611
|
-
var text = getLine(doc
|
|
7621
|
+
var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
|
|
7612
7622
|
if (left == right)
|
|
7613
7623
|
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
|
|
7614
7624
|
else if (text.length > leftPos)
|
|
7615
7625
|
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
|
|
7616
7626
|
}
|
|
7617
7627
|
if (!ranges.length) { ranges.push(new Range(start, start)); }
|
|
7618
|
-
setSelection(doc
|
|
7628
|
+
setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
|
|
7619
7629
|
{origin: "*mouse", scroll: false});
|
|
7620
7630
|
cm.scrollIntoView(pos);
|
|
7621
7631
|
} else {
|
|
@@ -7630,8 +7640,8 @@ var codemirror = {exports: {}};
|
|
|
7630
7640
|
anchor = maxPos(oldRange.to(), range.head);
|
|
7631
7641
|
}
|
|
7632
7642
|
var ranges$1 = startSel.ranges.slice(0);
|
|
7633
|
-
ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc
|
|
7634
|
-
setSelection(doc
|
|
7643
|
+
ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
|
|
7644
|
+
setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
|
|
7635
7645
|
}
|
|
7636
7646
|
}
|
|
7637
7647
|
|
|
@@ -7647,9 +7657,9 @@ var codemirror = {exports: {}};
|
|
|
7647
7657
|
var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
|
|
7648
7658
|
if (!cur) { return }
|
|
7649
7659
|
if (cmp(cur, lastPos) != 0) {
|
|
7650
|
-
cm.curOp.focus = activeElt(
|
|
7660
|
+
cm.curOp.focus = activeElt(root(cm));
|
|
7651
7661
|
extendTo(cur);
|
|
7652
|
-
var visible = visibleLines(display, doc
|
|
7662
|
+
var visible = visibleLines(display, doc);
|
|
7653
7663
|
if (cur.line >= visible.to || cur.line < visible.from)
|
|
7654
7664
|
{ setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
|
|
7655
7665
|
} else {
|
|
@@ -7674,7 +7684,7 @@ var codemirror = {exports: {}};
|
|
|
7674
7684
|
}
|
|
7675
7685
|
off(display.wrapper.ownerDocument, "mousemove", move);
|
|
7676
7686
|
off(display.wrapper.ownerDocument, "mouseup", up);
|
|
7677
|
-
doc
|
|
7687
|
+
doc.history.lastSelOrigin = null;
|
|
7678
7688
|
}
|
|
7679
7689
|
|
|
7680
7690
|
var move = operation(cm, function (e) {
|
|
@@ -8674,7 +8684,7 @@ var codemirror = {exports: {}};
|
|
|
8674
8684
|
|
|
8675
8685
|
signal(this, "overwriteToggle", this, this.state.overwrite);
|
|
8676
8686
|
},
|
|
8677
|
-
hasFocus: function() { return this.display.input.getField() == activeElt(
|
|
8687
|
+
hasFocus: function() { return this.display.input.getField() == activeElt(root(this)) },
|
|
8678
8688
|
isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
|
|
8679
8689
|
|
|
8680
8690
|
scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
|
|
@@ -8956,7 +8966,7 @@ var codemirror = {exports: {}};
|
|
|
8956
8966
|
disableBrowserMagic(te);
|
|
8957
8967
|
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
|
|
8958
8968
|
te.value = lastCopied.text.join("\n");
|
|
8959
|
-
var hadFocus = activeElt(div
|
|
8969
|
+
var hadFocus = activeElt(rootNode(div));
|
|
8960
8970
|
selectInput(te);
|
|
8961
8971
|
setTimeout(function () {
|
|
8962
8972
|
cm.display.lineSpace.removeChild(kludge);
|
|
@@ -8979,7 +8989,7 @@ var codemirror = {exports: {}};
|
|
|
8979
8989
|
|
|
8980
8990
|
ContentEditableInput.prototype.prepareSelection = function () {
|
|
8981
8991
|
var result = prepareSelection(this.cm, false);
|
|
8982
|
-
result.focus = activeElt(this.div
|
|
8992
|
+
result.focus = activeElt(rootNode(this.div)) == this.div;
|
|
8983
8993
|
return result
|
|
8984
8994
|
};
|
|
8985
8995
|
|
|
@@ -9075,7 +9085,7 @@ var codemirror = {exports: {}};
|
|
|
9075
9085
|
|
|
9076
9086
|
ContentEditableInput.prototype.focus = function () {
|
|
9077
9087
|
if (this.cm.options.readOnly != "nocursor") {
|
|
9078
|
-
if (!this.selectionInEditor() || activeElt(this.div
|
|
9088
|
+
if (!this.selectionInEditor() || activeElt(rootNode(this.div)) != this.div)
|
|
9079
9089
|
{ this.showSelection(this.prepareSelection(), true); }
|
|
9080
9090
|
this.div.focus();
|
|
9081
9091
|
}
|
|
@@ -9583,7 +9593,7 @@ var codemirror = {exports: {}};
|
|
|
9583
9593
|
TextareaInput.prototype.supportsTouch = function () { return false };
|
|
9584
9594
|
|
|
9585
9595
|
TextareaInput.prototype.focus = function () {
|
|
9586
|
-
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(this.textarea
|
|
9596
|
+
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(rootNode(this.textarea)) != this.textarea)) {
|
|
9587
9597
|
try { this.textarea.focus(); }
|
|
9588
9598
|
catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
|
|
9589
9599
|
}
|
|
@@ -9790,7 +9800,7 @@ var codemirror = {exports: {}};
|
|
|
9790
9800
|
// Set autofocus to true if this textarea is focused, or if it has
|
|
9791
9801
|
// autofocus and no other element is focused.
|
|
9792
9802
|
if (options.autofocus == null) {
|
|
9793
|
-
var hasFocus = activeElt(textarea
|
|
9803
|
+
var hasFocus = activeElt(rootNode(textarea));
|
|
9794
9804
|
options.autofocus = hasFocus == textarea ||
|
|
9795
9805
|
textarea.getAttribute("autofocus") != null && hasFocus == document.body;
|
|
9796
9806
|
}
|
|
@@ -9924,7 +9934,7 @@ var codemirror = {exports: {}};
|
|
|
9924
9934
|
|
|
9925
9935
|
addLegacyProps(CodeMirror);
|
|
9926
9936
|
|
|
9927
|
-
CodeMirror.version = "5.65.
|
|
9937
|
+
CodeMirror.version = "5.65.16";
|
|
9928
9938
|
|
|
9929
9939
|
return CodeMirror;
|
|
9930
9940
|
|
|
@@ -16391,6 +16401,7 @@ var Editor = /** @class */ (function (_super) {
|
|
|
16391
16401
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
16392
16402
|
_this._markedText = [];
|
|
16393
16403
|
_this._initialText = "";
|
|
16404
|
+
_this._options = new Map();
|
|
16394
16405
|
return _this;
|
|
16395
16406
|
}
|
|
16396
16407
|
Editor.prototype.options = function () {
|
|
@@ -16401,6 +16412,19 @@ var Editor = /** @class */ (function (_super) {
|
|
|
16401
16412
|
tabSize: 2
|
|
16402
16413
|
};
|
|
16403
16414
|
};
|
|
16415
|
+
Editor.prototype.option = function (option, value) {
|
|
16416
|
+
if (this._codemirror) {
|
|
16417
|
+
if (arguments.length < 2) {
|
|
16418
|
+
return this._codemirror.getOption(option);
|
|
16419
|
+
}
|
|
16420
|
+
this._codemirror.setOption(option, value);
|
|
16421
|
+
return this;
|
|
16422
|
+
}
|
|
16423
|
+
if (arguments.length < 2) {
|
|
16424
|
+
return this._options.get(option);
|
|
16425
|
+
}
|
|
16426
|
+
this._options.set(option, value);
|
|
16427
|
+
};
|
|
16404
16428
|
Editor.prototype.guttersOption = function () {
|
|
16405
16429
|
var gutters = ["CodeMirror-linenumbers"];
|
|
16406
16430
|
if (this.gutterMarkerWidth() > 0) {
|
|
@@ -16522,6 +16546,9 @@ var Editor = /** @class */ (function (_super) {
|
|
|
16522
16546
|
this._codemirror.on("changes", function (cm, changes) {
|
|
16523
16547
|
_this.changes(changes);
|
|
16524
16548
|
});
|
|
16549
|
+
this._options.forEach(function (value, key) {
|
|
16550
|
+
_this._codemirror.setOption(key, value);
|
|
16551
|
+
});
|
|
16525
16552
|
this.text(this._initialText);
|
|
16526
16553
|
};
|
|
16527
16554
|
Editor.prototype.update = function (domNode, Element) {
|
|
@@ -16534,6 +16561,9 @@ var Editor = /** @class */ (function (_super) {
|
|
|
16534
16561
|
// Events ---
|
|
16535
16562
|
Editor.prototype.changes = function (changes) {
|
|
16536
16563
|
};
|
|
16564
|
+
/**
|
|
16565
|
+
* @deprecated Replaced with `option`
|
|
16566
|
+
*/
|
|
16537
16567
|
Editor.prototype.setOption = function (option, value) {
|
|
16538
16568
|
this._codemirror.setOption(option, value);
|
|
16539
16569
|
};
|