@hpcc-js/codemirror 2.60.0 → 2.60.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.js CHANGED
@@ -5,10 +5,10 @@
5
5
  })(this, (function (exports, common) { 'use strict';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/codemirror";
8
- var PKG_VERSION = "2.60.0";
9
- var BUILD_VERSION = "2.104.0";
8
+ var PKG_VERSION = "2.60.1";
9
+ var BUILD_VERSION = "2.104.2";
10
10
 
11
- /*! *****************************************************************************
11
+ /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
13
13
 
14
14
  Permission to use, copy, modify, and/or distribute this software for any
@@ -58,9 +58,9 @@
58
58
 
59
59
  (function (module, exports) {
60
60
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
61
- // Distributed under an MIT license: https://codemirror.net/LICENSE
61
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
62
62
 
63
- // This is CodeMirror (https://codemirror.net), a code editor
63
+ // This is CodeMirror (https://codemirror.net/5), a code editor
64
64
  // implemented in JavaScript on top of the browser's DOM.
65
65
  //
66
66
  // You can find some technical background for some of the code below
@@ -82,7 +82,8 @@
82
82
  var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
83
83
  var webkit = !edge && /WebKit\//.test(userAgent);
84
84
  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
85
- var chrome = !edge && /Chrome\//.test(userAgent);
85
+ var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent);
86
+ var chrome_version = chrome && +chrome[1];
86
87
  var presto = /Opera\//.test(userAgent);
87
88
  var safari = /Apple Computer/.test(navigator.vendor);
88
89
  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
@@ -167,15 +168,15 @@
167
168
  } while (child = child.parentNode)
168
169
  }
169
170
 
170
- function activeElt() {
171
+ function activeElt(doc) {
171
172
  // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
172
173
  // IE < 10 will throw when accessed while the page is loading or in an iframe.
173
174
  // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
174
175
  var activeElement;
175
176
  try {
176
- activeElement = document.activeElement;
177
+ activeElement = doc.activeElement;
177
178
  } catch(e) {
178
- activeElement = document.body || null;
179
+ activeElement = doc.body || null;
179
180
  }
180
181
  while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
181
182
  { activeElement = activeElement.shadowRoot.activeElement; }
@@ -199,6 +200,10 @@
199
200
  else if (ie) // Suppress mysterious IE10 errors
200
201
  { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
201
202
 
203
+ function doc(cm) { return cm.display.wrapper.ownerDocument }
204
+
205
+ function win(cm) { return doc(cm).defaultView }
206
+
202
207
  function bind(f) {
203
208
  var args = Array.prototype.slice.call(arguments, 1);
204
209
  return function(){return f.apply(null, args)}
@@ -1380,7 +1385,7 @@
1380
1385
  // Add a span to a line.
1381
1386
  function addMarkedSpan(line, span, op) {
1382
1387
  var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));
1383
- if (inThisOp && inThisOp.has(line.markedSpans)) {
1388
+ if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {
1384
1389
  line.markedSpans.push(span);
1385
1390
  } else {
1386
1391
  line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
@@ -2628,16 +2633,16 @@
2628
2633
  cm.display.lineNumChars = null;
2629
2634
  }
2630
2635
 
2631
- function pageScrollX() {
2636
+ function pageScrollX(doc) {
2632
2637
  // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
2633
2638
  // which causes page_Offset and bounding client rects to use
2634
2639
  // different reference viewports and invalidate our calculations.
2635
- if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
2636
- return window.pageXOffset || (document.documentElement || document.body).scrollLeft
2640
+ if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) }
2641
+ return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft
2637
2642
  }
2638
- function pageScrollY() {
2639
- if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
2640
- return window.pageYOffset || (document.documentElement || document.body).scrollTop
2643
+ function pageScrollY(doc) {
2644
+ if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) }
2645
+ return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop
2641
2646
  }
2642
2647
 
2643
2648
  function widgetTopHeight(lineObj) {
@@ -2665,8 +2670,8 @@
2665
2670
  else { yOff -= cm.display.viewOffset; }
2666
2671
  if (context == "page" || context == "window") {
2667
2672
  var lOff = cm.display.lineSpace.getBoundingClientRect();
2668
- yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
2669
- var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
2673
+ yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm)));
2674
+ var xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm)));
2670
2675
  rect.left += xOff; rect.right += xOff;
2671
2676
  }
2672
2677
  rect.top += yOff; rect.bottom += yOff;
@@ -2680,8 +2685,8 @@
2680
2685
  var left = coords.left, top = coords.top;
2681
2686
  // First move into "page" coordinate system
2682
2687
  if (context == "page") {
2683
- left -= pageScrollX();
2684
- top -= pageScrollY();
2688
+ left -= pageScrollX(doc(cm));
2689
+ top -= pageScrollY(doc(cm));
2685
2690
  } else if (context == "local" || !context) {
2686
2691
  var localBox = cm.display.sizer.getBoundingClientRect();
2687
2692
  left += localBox.left;
@@ -3497,8 +3502,9 @@
3497
3502
  if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
3498
3503
 
3499
3504
  var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
3505
+ var doc = display.wrapper.ownerDocument;
3500
3506
  if (rect.top + box.top < 0) { doScroll = true; }
3501
- else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
3507
+ else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }
3502
3508
  if (doScroll != null && !phantom) {
3503
3509
  var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
3504
3510
  cm.display.lineSpace.appendChild(scrollNode);
@@ -3752,13 +3758,13 @@
3752
3758
  NativeScrollbars.prototype.zeroWidthHack = function () {
3753
3759
  var w = mac && !mac_geMountainLion ? "12px" : "18px";
3754
3760
  this.horiz.style.height = this.vert.style.width = w;
3755
- this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
3761
+ this.horiz.style.visibility = this.vert.style.visibility = "hidden";
3756
3762
  this.disableHoriz = new Delayed;
3757
3763
  this.disableVert = new Delayed;
3758
3764
  };
3759
3765
 
3760
3766
  NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
3761
- bar.style.pointerEvents = "auto";
3767
+ bar.style.visibility = "";
3762
3768
  function maybeDisable() {
3763
3769
  // To find out whether the scrollbar is still visible, we
3764
3770
  // check whether the element under the pixel in the bottom
@@ -3769,7 +3775,7 @@
3769
3775
  var box = bar.getBoundingClientRect();
3770
3776
  var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
3771
3777
  : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
3772
- if (elt != bar) { bar.style.pointerEvents = "none"; }
3778
+ if (elt != bar) { bar.style.visibility = "hidden"; }
3773
3779
  else { delay.set(1000, maybeDisable); }
3774
3780
  }
3775
3781
  delay.set(1000, maybeDisable);
@@ -3950,7 +3956,7 @@
3950
3956
  cm.display.maxLineChanged = false;
3951
3957
  }
3952
3958
 
3953
- var takeFocus = op.focus && op.focus == activeElt();
3959
+ var takeFocus = op.focus && op.focus == activeElt(doc(cm));
3954
3960
  if (op.preparedSelection)
3955
3961
  { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
3956
3962
  if (op.updatedDisplay || op.startHeight != cm.doc.height)
@@ -4127,11 +4133,11 @@
4127
4133
 
4128
4134
  function selectionSnapshot(cm) {
4129
4135
  if (cm.hasFocus()) { return null }
4130
- var active = activeElt();
4136
+ var active = activeElt(doc(cm));
4131
4137
  if (!active || !contains(cm.display.lineDiv, active)) { return null }
4132
4138
  var result = {activeElt: active};
4133
4139
  if (window.getSelection) {
4134
- var sel = window.getSelection();
4140
+ var sel = win(cm).getSelection();
4135
4141
  if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
4136
4142
  result.anchorNode = sel.anchorNode;
4137
4143
  result.anchorOffset = sel.anchorOffset;
@@ -4143,11 +4149,12 @@
4143
4149
  }
4144
4150
 
4145
4151
  function restoreSelection(snapshot) {
4146
- if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
4152
+ if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(snapshot.activeElt.ownerDocument)) { return }
4147
4153
  snapshot.activeElt.focus();
4148
4154
  if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
4149
4155
  snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
4150
- var sel = window.getSelection(), range = document.createRange();
4156
+ var doc = snapshot.activeElt.ownerDocument;
4157
+ var sel = doc.defaultView.getSelection(), range = doc.createRange();
4151
4158
  range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
4152
4159
  range.collapse(false);
4153
4160
  sel.removeAllRanges();
@@ -4565,6 +4572,17 @@
4565
4572
  }
4566
4573
 
4567
4574
  function onScrollWheel(cm, e) {
4575
+ // On Chrome 102, viewport updates somehow stop wheel-based
4576
+ // scrolling. Turning off pointer events during the scroll seems
4577
+ // to avoid the issue.
4578
+ if (chrome && chrome_version == 102) {
4579
+ if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; }
4580
+ else { clearTimeout(cm.display.chromeScrollHack); }
4581
+ cm.display.chromeScrollHack = setTimeout(function () {
4582
+ cm.display.chromeScrollHack = null;
4583
+ cm.display.sizer.style.pointerEvents = "";
4584
+ }, 100);
4585
+ }
4568
4586
  var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
4569
4587
  var pixelsPerUnit = wheelPixelsPerUnit;
4570
4588
  if (e.deltaMode === 0) {
@@ -5248,7 +5266,7 @@
5248
5266
  var range = sel.ranges[i];
5249
5267
  var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
5250
5268
  var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
5251
- var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
5269
+ var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);
5252
5270
  if (out || newAnchor != range.anchor || newHead != range.head) {
5253
5271
  if (!out) { out = sel.ranges.slice(0, i); }
5254
5272
  out[i] = new Range(newAnchor, newHead);
@@ -7300,7 +7318,7 @@
7300
7318
  function onKeyDown(e) {
7301
7319
  var cm = this;
7302
7320
  if (e.target && e.target != cm.display.input.getField()) { return }
7303
- cm.curOp.focus = activeElt();
7321
+ cm.curOp.focus = activeElt(doc(cm));
7304
7322
  if (signalDOMEvent(cm, e)) { return }
7305
7323
  // IE does strange things with escape.
7306
7324
  if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
@@ -7407,7 +7425,7 @@
7407
7425
  }
7408
7426
  if (clickInGutter(cm, e)) { return }
7409
7427
  var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
7410
- window.focus();
7428
+ win(cm).focus();
7411
7429
 
7412
7430
  // #3261: make sure, that we're not starting a second selection
7413
7431
  if (button == 1 && cm.state.selectingText)
@@ -7462,7 +7480,7 @@
7462
7480
 
7463
7481
  function leftButtonDown(cm, pos, repeat, event) {
7464
7482
  if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
7465
- else { cm.curOp.focus = activeElt(); }
7483
+ else { cm.curOp.focus = activeElt(doc(cm)); }
7466
7484
 
7467
7485
  var behavior = configureMouse(cm, repeat, event);
7468
7486
 
@@ -7532,19 +7550,19 @@
7532
7550
  // Normal selection, as opposed to text dragging.
7533
7551
  function leftButtonSelect(cm, event, start, behavior) {
7534
7552
  if (ie) { delayBlurEvent(cm); }
7535
- var display = cm.display, doc = cm.doc;
7553
+ var display = cm.display, doc$1 = cm.doc;
7536
7554
  e_preventDefault(event);
7537
7555
 
7538
- var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
7556
+ var ourRange, ourIndex, startSel = doc$1.sel, ranges = startSel.ranges;
7539
7557
  if (behavior.addNew && !behavior.extend) {
7540
- ourIndex = doc.sel.contains(start);
7558
+ ourIndex = doc$1.sel.contains(start);
7541
7559
  if (ourIndex > -1)
7542
7560
  { ourRange = ranges[ourIndex]; }
7543
7561
  else
7544
7562
  { ourRange = new Range(start, start); }
7545
7563
  } else {
7546
- ourRange = doc.sel.primary();
7547
- ourIndex = doc.sel.primIndex;
7564
+ ourRange = doc$1.sel.primary();
7565
+ ourIndex = doc$1.sel.primIndex;
7548
7566
  }
7549
7567
 
7550
7568
  if (behavior.unit == "rectangle") {
@@ -7561,18 +7579,18 @@
7561
7579
 
7562
7580
  if (!behavior.addNew) {
7563
7581
  ourIndex = 0;
7564
- setSelection(doc, new Selection([ourRange], 0), sel_mouse);
7565
- startSel = doc.sel;
7582
+ setSelection(doc$1, new Selection([ourRange], 0), sel_mouse);
7583
+ startSel = doc$1.sel;
7566
7584
  } else if (ourIndex == -1) {
7567
7585
  ourIndex = ranges.length;
7568
- setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
7586
+ setSelection(doc$1, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
7569
7587
  {scroll: false, origin: "*mouse"});
7570
7588
  } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
7571
- setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
7589
+ setSelection(doc$1, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
7572
7590
  {scroll: false, origin: "*mouse"});
7573
- startSel = doc.sel;
7591
+ startSel = doc$1.sel;
7574
7592
  } else {
7575
- replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
7593
+ replaceOneSelection(doc$1, ourIndex, ourRange, sel_mouse);
7576
7594
  }
7577
7595
 
7578
7596
  var lastPos = start;
@@ -7582,19 +7600,19 @@
7582
7600
 
7583
7601
  if (behavior.unit == "rectangle") {
7584
7602
  var ranges = [], tabSize = cm.options.tabSize;
7585
- var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
7586
- var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
7603
+ var startCol = countColumn(getLine(doc$1, start.line).text, start.ch, tabSize);
7604
+ var posCol = countColumn(getLine(doc$1, pos.line).text, pos.ch, tabSize);
7587
7605
  var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
7588
7606
  for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
7589
7607
  line <= end; line++) {
7590
- var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
7608
+ var text = getLine(doc$1, line).text, leftPos = findColumn(text, left, tabSize);
7591
7609
  if (left == right)
7592
7610
  { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
7593
7611
  else if (text.length > leftPos)
7594
7612
  { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
7595
7613
  }
7596
7614
  if (!ranges.length) { ranges.push(new Range(start, start)); }
7597
- setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
7615
+ setSelection(doc$1, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
7598
7616
  {origin: "*mouse", scroll: false});
7599
7617
  cm.scrollIntoView(pos);
7600
7618
  } else {
@@ -7609,8 +7627,8 @@
7609
7627
  anchor = maxPos(oldRange.to(), range.head);
7610
7628
  }
7611
7629
  var ranges$1 = startSel.ranges.slice(0);
7612
- ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
7613
- setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
7630
+ ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc$1, anchor), head));
7631
+ setSelection(doc$1, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
7614
7632
  }
7615
7633
  }
7616
7634
 
@@ -7626,9 +7644,9 @@
7626
7644
  var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
7627
7645
  if (!cur) { return }
7628
7646
  if (cmp(cur, lastPos) != 0) {
7629
- cm.curOp.focus = activeElt();
7647
+ cm.curOp.focus = activeElt(doc(cm));
7630
7648
  extendTo(cur);
7631
- var visible = visibleLines(display, doc);
7649
+ var visible = visibleLines(display, doc$1);
7632
7650
  if (cur.line >= visible.to || cur.line < visible.from)
7633
7651
  { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
7634
7652
  } else {
@@ -7653,7 +7671,7 @@
7653
7671
  }
7654
7672
  off(display.wrapper.ownerDocument, "mousemove", move);
7655
7673
  off(display.wrapper.ownerDocument, "mouseup", up);
7656
- doc.history.lastSelOrigin = null;
7674
+ doc$1.history.lastSelOrigin = null;
7657
7675
  }
7658
7676
 
7659
7677
  var move = operation(cm, function (e) {
@@ -8253,7 +8271,7 @@
8253
8271
  var pasted = e.clipboardData && e.clipboardData.getData("Text");
8254
8272
  if (pasted) {
8255
8273
  e.preventDefault();
8256
- if (!cm.isReadOnly() && !cm.options.disableInput)
8274
+ if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
8257
8275
  { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
8258
8276
  return true
8259
8277
  }
@@ -8330,7 +8348,7 @@
8330
8348
 
8331
8349
  CodeMirror.prototype = {
8332
8350
  constructor: CodeMirror,
8333
- focus: function(){window.focus(); this.display.input.focus();},
8351
+ focus: function(){win(this).focus(); this.display.input.focus();},
8334
8352
 
8335
8353
  setOption: function(option, value) {
8336
8354
  var options = this.options, old = options[option];
@@ -8654,7 +8672,7 @@
8654
8672
 
8655
8673
  signal(this, "overwriteToggle", this, this.state.overwrite);
8656
8674
  },
8657
- hasFocus: function() { return this.display.input.getField() == activeElt() },
8675
+ hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },
8658
8676
  isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
8659
8677
 
8660
8678
  scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
@@ -8835,7 +8853,7 @@
8835
8853
  function findPosV(cm, pos, dir, unit) {
8836
8854
  var doc = cm.doc, x = pos.left, y;
8837
8855
  if (unit == "page") {
8838
- var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
8856
+ var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);
8839
8857
  var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
8840
8858
  y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
8841
8859
 
@@ -8935,7 +8953,7 @@
8935
8953
  var kludge = hiddenTextarea(), te = kludge.firstChild;
8936
8954
  cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
8937
8955
  te.value = lastCopied.text.join("\n");
8938
- var hadFocus = activeElt();
8956
+ var hadFocus = activeElt(div.ownerDocument);
8939
8957
  selectInput(te);
8940
8958
  setTimeout(function () {
8941
8959
  cm.display.lineSpace.removeChild(kludge);
@@ -8958,7 +8976,7 @@
8958
8976
 
8959
8977
  ContentEditableInput.prototype.prepareSelection = function () {
8960
8978
  var result = prepareSelection(this.cm, false);
8961
- result.focus = activeElt() == this.div;
8979
+ result.focus = activeElt(this.div.ownerDocument) == this.div;
8962
8980
  return result
8963
8981
  };
8964
8982
 
@@ -9054,7 +9072,7 @@
9054
9072
 
9055
9073
  ContentEditableInput.prototype.focus = function () {
9056
9074
  if (this.cm.options.readOnly != "nocursor") {
9057
- if (!this.selectionInEditor() || activeElt() != this.div)
9075
+ if (!this.selectionInEditor() || activeElt(this.div.ownerDocument) != this.div)
9058
9076
  { this.showSelection(this.prepareSelection(), true); }
9059
9077
  this.div.focus();
9060
9078
  }
@@ -9557,7 +9575,7 @@
9557
9575
  TextareaInput.prototype.supportsTouch = function () { return false };
9558
9576
 
9559
9577
  TextareaInput.prototype.focus = function () {
9560
- if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
9578
+ if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(this.textarea.ownerDocument) != this.textarea)) {
9561
9579
  try { this.textarea.focus(); }
9562
9580
  catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
9563
9581
  }
@@ -9680,9 +9698,9 @@
9680
9698
  input.wrapper.style.cssText = "position: static";
9681
9699
  te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
9682
9700
  var oldScrollY;
9683
- if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
9701
+ if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712)
9684
9702
  display.input.focus();
9685
- if (webkit) { window.scrollTo(null, oldScrollY); }
9703
+ if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); }
9686
9704
  display.input.reset();
9687
9705
  // Adds "Select all" to context menu in FF
9688
9706
  if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
@@ -9764,7 +9782,7 @@
9764
9782
  // Set autofocus to true if this textarea is focused, or if it has
9765
9783
  // autofocus and no other element is focused.
9766
9784
  if (options.autofocus == null) {
9767
- var hasFocus = activeElt();
9785
+ var hasFocus = activeElt(textarea.ownerDocument);
9768
9786
  options.autofocus = hasFocus == textarea ||
9769
9787
  textarea.getAttribute("autofocus") != null && hasFocus == document.body;
9770
9788
  }
@@ -9898,7 +9916,7 @@
9898
9916
 
9899
9917
  addLegacyProps(CodeMirror);
9900
9918
 
9901
- CodeMirror.version = "5.65.2";
9919
+ CodeMirror.version = "5.65.7";
9902
9920
 
9903
9921
  return CodeMirror;
9904
9922
 
@@ -9909,7 +9927,7 @@
9909
9927
 
9910
9928
  (function (module, exports) {
9911
9929
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
9912
- // Distributed under an MIT license: https://codemirror.net/LICENSE
9930
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
9913
9931
 
9914
9932
  (function(mod) {
9915
9933
  mod(codemirror.exports);
@@ -10132,7 +10150,7 @@
10132
10150
  if (type == "}" || type == "{") return popAndPass(type, stream, state);
10133
10151
  if (type == "(") return pushContext(state, stream, "parens");
10134
10152
 
10135
- if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
10153
+ if (type == "hash" && !/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(stream.current())) {
10136
10154
  override += " error";
10137
10155
  } else if (type == "word") {
10138
10156
  wordAsValue(stream);
@@ -10535,7 +10553,7 @@
10535
10553
  "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
10536
10554
  "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary",
10537
10555
  "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box",
10538
- "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button", "button-bevel",
10556
+ "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button",
10539
10557
  "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
10540
10558
  "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
10541
10559
  "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
@@ -10573,14 +10591,10 @@
10573
10591
  "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
10574
10592
  "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
10575
10593
  "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d",
10576
- "media-controls-background", "media-current-time-display",
10577
- "media-fullscreen-button", "media-mute-button", "media-play-button",
10578
- "media-return-to-realtime-button", "media-rewind-button",
10579
- "media-seek-back-button", "media-seek-forward-button", "media-slider",
10580
- "media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
10581
- "media-volume-slider-container", "media-volume-sliderthumb", "medium",
10582
- "menu", "menulist", "menulist-button", "menulist-text",
10583
- "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
10594
+ "media-play-button", "media-slider", "media-sliderthumb",
10595
+ "media-volume-slider", "media-volume-sliderthumb", "medium",
10596
+ "menu", "menulist", "menulist-button",
10597
+ "menutext", "message-box", "middle", "min-intrinsic",
10584
10598
  "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize",
10585
10599
  "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
10586
10600
  "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
@@ -10772,7 +10786,7 @@
10772
10786
 
10773
10787
  (function (module, exports) {
10774
10788
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
10775
- // Distributed under an MIT license: https://codemirror.net/LICENSE
10789
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
10776
10790
 
10777
10791
  (function(mod) {
10778
10792
  mod(codemirror.exports);
@@ -10979,7 +10993,7 @@
10979
10993
 
10980
10994
  (function (module, exports) {
10981
10995
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
10982
- // Distributed under an MIT license: https://codemirror.net/LICENSE
10996
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
10983
10997
 
10984
10998
  (function(mod) {
10985
10999
  mod(codemirror.exports);
@@ -11395,7 +11409,7 @@
11395
11409
 
11396
11410
  (function (module, exports) {
11397
11411
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
11398
- // Distributed under an MIT license: https://codemirror.net/LICENSE
11412
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11399
11413
 
11400
11414
  (function(mod) {
11401
11415
  mod(codemirror.exports);
@@ -11613,7 +11627,7 @@
11613
11627
 
11614
11628
  (function (module, exports) {
11615
11629
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
11616
- // Distributed under an MIT license: https://codemirror.net/LICENSE
11630
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
11617
11631
 
11618
11632
  (function(mod) {
11619
11633
  mod(codemirror.exports, xml.exports, meta.exports);
@@ -12498,7 +12512,7 @@
12498
12512
 
12499
12513
  (function (module, exports) {
12500
12514
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
12501
- // Distributed under an MIT license: https://codemirror.net/LICENSE
12515
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
12502
12516
 
12503
12517
  // Utility function that allows modes to be combined. The mode given
12504
12518
  // as the base argument takes care of most of the normal mode
@@ -12585,7 +12599,7 @@
12585
12599
 
12586
12600
  (function (module, exports) {
12587
12601
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
12588
- // Distributed under an MIT license: https://codemirror.net/LICENSE
12602
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
12589
12603
 
12590
12604
  (function(mod) {
12591
12605
  mod(codemirror.exports, markdown.exports, overlay.exports);
@@ -12713,7 +12727,7 @@
12713
12727
 
12714
12728
  (function (module, exports) {
12715
12729
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
12716
- // Distributed under an MIT license: https://codemirror.net/LICENSE
12730
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
12717
12731
 
12718
12732
  (function(mod) {
12719
12733
  mod(codemirror.exports);
@@ -13669,7 +13683,7 @@
13669
13683
 
13670
13684
  (function (module, exports) {
13671
13685
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
13672
- // Distributed under an MIT license: https://codemirror.net/LICENSE
13686
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
13673
13687
 
13674
13688
  (function(mod) {
13675
13689
  mod(codemirror.exports, xml.exports, javascript.exports, css.exports);
@@ -14799,7 +14813,7 @@
14799
14813
 
14800
14814
  (function (module, exports) {
14801
14815
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
14802
- // Distributed under an MIT license: https://codemirror.net/LICENSE
14816
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
14803
14817
 
14804
14818
  (function(mod) {
14805
14819
  mod(codemirror.exports);
@@ -14915,7 +14929,7 @@
14915
14929
 
14916
14930
  (function (module, exports) {
14917
14931
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
14918
- // Distributed under an MIT license: https://codemirror.net/LICENSE
14932
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
14919
14933
 
14920
14934
  (function(mod) {
14921
14935
  mod(codemirror.exports);
@@ -14973,7 +14987,7 @@
14973
14987
 
14974
14988
  (function (module, exports) {
14975
14989
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
14976
- // Distributed under an MIT license: https://codemirror.net/LICENSE
14990
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
14977
14991
 
14978
14992
  (function(mod) {
14979
14993
  mod(codemirror.exports);
@@ -15129,7 +15143,7 @@
15129
15143
 
15130
15144
  (function (module, exports) {
15131
15145
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15132
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15146
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15133
15147
 
15134
15148
  (function(mod) {
15135
15149
  mod(codemirror.exports, foldcode.exports);
@@ -15289,7 +15303,7 @@
15289
15303
 
15290
15304
  (function (module, exports) {
15291
15305
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15292
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15306
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15293
15307
 
15294
15308
  (function(mod) {
15295
15309
  mod(codemirror.exports);
@@ -15333,7 +15347,7 @@
15333
15347
 
15334
15348
  (function (module, exports) {
15335
15349
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15336
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15350
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15337
15351
 
15338
15352
  (function(mod) {
15339
15353
  mod(codemirror.exports);
@@ -15519,7 +15533,7 @@
15519
15533
 
15520
15534
  (function (module, exports) {
15521
15535
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15522
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15536
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15523
15537
 
15524
15538
  // Open simple dialogs on top of an editor. Relies on dialog.css.
15525
15539
 
@@ -15680,7 +15694,7 @@
15680
15694
 
15681
15695
  (function (module, exports) {
15682
15696
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15683
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15697
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15684
15698
 
15685
15699
  // Defines jumpToLine command. Uses dialog.js if present.
15686
15700
 
@@ -15732,7 +15746,7 @@
15732
15746
 
15733
15747
  (function (module, exports) {
15734
15748
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
15735
- // Distributed under an MIT license: https://codemirror.net/LICENSE
15749
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
15736
15750
 
15737
15751
  (function(mod) {
15738
15752
  mod(codemirror.exports);
@@ -16034,7 +16048,7 @@
16034
16048
 
16035
16049
  (function (module, exports) {
16036
16050
  // CodeMirror, copyright (c) by Marijn Haverbeke and others
16037
- // Distributed under an MIT license: https://codemirror.net/LICENSE
16051
+ // Distributed under an MIT license: https://codemirror.net/5/LICENSE
16038
16052
 
16039
16053
  // Define search commands. Depends on dialog.js or another
16040
16054
  // implementation of the openDialog method.
@@ -16231,16 +16245,19 @@
16231
16245
  }
16232
16246
 
16233
16247
  function getQueryDialog(cm) {
16234
- return el("", null,
16235
- el("span", {className: "CodeMirror-search-label"}, cm.phrase("Search:")), " ",
16236
- el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ",
16237
- el("span", {style: "color: #888", className: "CodeMirror-search-hint"},
16248
+ var label = el("label", {className: "CodeMirror-search-label"},
16249
+ cm.phrase("Search:"),
16250
+ el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field",
16251
+ id: "CodeMirror-search-field"}));
16252
+ label.setAttribute("for","CodeMirror-search-field");
16253
+ return el("", null, label, " ",
16254
+ el("span", {style: "color: #666", className: "CodeMirror-search-hint"},
16238
16255
  cm.phrase("(Use /re/ syntax for regexp search)")));
16239
16256
  }
16240
16257
  function getReplaceQueryDialog(cm) {
16241
16258
  return el("", null, " ",
16242
16259
  el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ",
16243
- el("span", {style: "color: #888", className: "CodeMirror-search-hint"},
16260
+ el("span", {style: "color: #666", className: "CodeMirror-search-hint"},
16244
16261
  cm.phrase("(Use /re/ syntax for regexp search)")));
16245
16262
  }
16246
16263
  function getReplacementQueryDialog(cm) {