@codemirror/view 6.38.1 → 6.38.3
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +64 -42
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -42
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 6.38.3 (2025-09-22)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Work around a rendering bug in Mobile Safari by completely hiding empty layers.
|
|
6
|
+
|
|
7
|
+
Fix vertical cursor motion in Chrome around decorations with bottom borders or margins.
|
|
8
|
+
|
|
9
|
+
Fix an issue that caused mark decorations longer than 512 characters to needlessly be split.
|
|
10
|
+
|
|
11
|
+
Move the cursor out of atomic ranges when text input happens.
|
|
12
|
+
|
|
13
|
+
## 6.38.2 (2025-09-01)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
Re-enable falling dispatching keys by key code for Cmd-Alt- combinations on macOS.
|
|
18
|
+
|
|
19
|
+
Make sure all pointer selections skip atomic ranges.
|
|
20
|
+
|
|
1
21
|
## 6.38.1 (2025-07-15)
|
|
2
22
|
|
|
3
23
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1786,13 +1786,14 @@ class ContentBuilder {
|
|
|
1786
1786
|
this.textOff = 0;
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
-
let
|
|
1789
|
+
let remaining = Math.min(this.text.length - this.textOff, length);
|
|
1790
|
+
let take = Math.min(remaining, 512 /* T.Chunk */);
|
|
1790
1791
|
this.flushBuffer(active.slice(active.length - openStart));
|
|
1791
1792
|
this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);
|
|
1792
1793
|
this.atCursorPos = true;
|
|
1793
1794
|
this.textOff += take;
|
|
1794
1795
|
length -= take;
|
|
1795
|
-
openStart = 0;
|
|
1796
|
+
openStart = remaining <= take ? 0 : active.length;
|
|
1796
1797
|
}
|
|
1797
1798
|
}
|
|
1798
1799
|
span(from, to, active, openStart) {
|
|
@@ -3607,14 +3608,13 @@ function posAtCoords(view, coords, precise, bias = -1) {
|
|
|
3607
3608
|
}
|
|
3608
3609
|
else if (doc.caretRangeFromPoint) {
|
|
3609
3610
|
let range = doc.caretRangeFromPoint(x, y);
|
|
3610
|
-
if (range)
|
|
3611
|
+
if (range)
|
|
3611
3612
|
({ startContainer: node, startOffset: offset } = range);
|
|
3612
|
-
if (!view.contentDOM.contains(node) ||
|
|
3613
|
-
browser.safari && isSuspiciousSafariCaretResult(node, offset, x) ||
|
|
3614
|
-
browser.chrome && isSuspiciousChromeCaretResult(node, offset, x))
|
|
3615
|
-
node = undefined;
|
|
3616
|
-
}
|
|
3617
3613
|
}
|
|
3614
|
+
if (node && (!view.contentDOM.contains(node) ||
|
|
3615
|
+
browser.safari && isSuspiciousSafariCaretResult(node, offset, x) ||
|
|
3616
|
+
browser.chrome && isSuspiciousChromeCaretResult(node, offset, x)))
|
|
3617
|
+
node = undefined;
|
|
3618
3618
|
// Chrome will return offsets into <input> elements without child
|
|
3619
3619
|
// nodes, which will lead to a null deref below, so clip the
|
|
3620
3620
|
// offset to the node size.
|
|
@@ -3650,11 +3650,7 @@ function posAtCoordsImprecise(view, contentRect, block, x, y) {
|
|
|
3650
3650
|
let content = view.state.sliceDoc(block.from, block.to);
|
|
3651
3651
|
return block.from + state.findColumn(content, into, view.state.tabSize);
|
|
3652
3652
|
}
|
|
3653
|
-
|
|
3654
|
-
// the space between lines as belonging to the last character of the
|
|
3655
|
-
// line before. This is used to detect such a result so that it can be
|
|
3656
|
-
// ignored (issue #401).
|
|
3657
|
-
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3653
|
+
function isEndOfLineBefore(node, offset, x) {
|
|
3658
3654
|
let len, scan = node;
|
|
3659
3655
|
if (node.nodeType != 3 || offset != (len = node.nodeValue.length))
|
|
3660
3656
|
return false;
|
|
@@ -3674,10 +3670,17 @@ function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
|
3674
3670
|
}
|
|
3675
3671
|
return textRange(node, len - 1, len).getBoundingClientRect().right > x;
|
|
3676
3672
|
}
|
|
3673
|
+
// In case of a high line height, Safari's caretRangeFromPoint treats
|
|
3674
|
+
// the space between lines as belonging to the last character of the
|
|
3675
|
+
// line before. This is used to detect such a result so that it can be
|
|
3676
|
+
// ignored (issue #401).
|
|
3677
|
+
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3678
|
+
return isEndOfLineBefore(node, offset, x);
|
|
3679
|
+
}
|
|
3677
3680
|
// Chrome will move positions between lines to the start of the next line
|
|
3678
3681
|
function isSuspiciousChromeCaretResult(node, offset, x) {
|
|
3679
3682
|
if (offset != 0)
|
|
3680
|
-
return
|
|
3683
|
+
return isEndOfLineBefore(node, offset, x);
|
|
3681
3684
|
for (let cur = node;;) {
|
|
3682
3685
|
let parent = cur.parentNode;
|
|
3683
3686
|
if (!parent || parent.nodeType != 1 || parent.firstChild != cur)
|
|
@@ -3802,6 +3805,29 @@ function skipAtomicRanges(atoms, pos, bias) {
|
|
|
3802
3805
|
return pos;
|
|
3803
3806
|
}
|
|
3804
3807
|
}
|
|
3808
|
+
function skipAtomsForSelection(atoms, sel) {
|
|
3809
|
+
let ranges = null;
|
|
3810
|
+
for (let i = 0; i < sel.ranges.length; i++) {
|
|
3811
|
+
let range = sel.ranges[i], updated = null;
|
|
3812
|
+
if (range.empty) {
|
|
3813
|
+
let pos = skipAtomicRanges(atoms, range.from, 0);
|
|
3814
|
+
if (pos != range.from)
|
|
3815
|
+
updated = state.EditorSelection.cursor(pos, -1);
|
|
3816
|
+
}
|
|
3817
|
+
else {
|
|
3818
|
+
let from = skipAtomicRanges(atoms, range.from, -1);
|
|
3819
|
+
let to = skipAtomicRanges(atoms, range.to, 1);
|
|
3820
|
+
if (from != range.from || to != range.to)
|
|
3821
|
+
updated = state.EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to);
|
|
3822
|
+
}
|
|
3823
|
+
if (updated) {
|
|
3824
|
+
if (!ranges)
|
|
3825
|
+
ranges = sel.ranges.slice();
|
|
3826
|
+
ranges[i] = updated;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
return ranges ? state.EditorSelection.create(ranges, sel.mainIndex) : sel;
|
|
3830
|
+
}
|
|
3805
3831
|
function skipAtoms(view, oldPos, pos) {
|
|
3806
3832
|
let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map(f => f(view)), pos.from, oldPos.head > pos.from ? -1 : 1);
|
|
3807
3833
|
return newPos == pos.from ? pos : state.EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1);
|
|
@@ -4037,6 +4063,8 @@ function applyDOMChange(view, domChange) {
|
|
|
4037
4063
|
if (view.inputState.lastSelectionOrigin == "select")
|
|
4038
4064
|
scrollIntoView = true;
|
|
4039
4065
|
userEvent = view.inputState.lastSelectionOrigin;
|
|
4066
|
+
if (userEvent == "select.pointer")
|
|
4067
|
+
newSel = skipAtomsForSelection(view.state.facet(atomicRanges).map(f => f(view)), newSel);
|
|
4040
4068
|
}
|
|
4041
4069
|
view.dispatch({ selection: newSel, scrollIntoView, userEvent });
|
|
4042
4070
|
return true;
|
|
@@ -4078,8 +4106,20 @@ function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
|
4078
4106
|
return true;
|
|
4079
4107
|
}
|
|
4080
4108
|
function applyDefaultInsert(view, change, newSel) {
|
|
4081
|
-
let tr, startState = view.state, sel = startState.selection.main;
|
|
4082
|
-
if (change.from
|
|
4109
|
+
let tr, startState = view.state, sel = startState.selection.main, inAtomic = -1;
|
|
4110
|
+
if (change.from == change.to && change.from < sel.from || change.from > sel.to) {
|
|
4111
|
+
let side = change.from < sel.from ? -1 : 1, pos = side < 0 ? sel.from : sel.to;
|
|
4112
|
+
let moved = skipAtomicRanges(startState.facet(atomicRanges).map(f => f(view)), pos, side);
|
|
4113
|
+
if (change.from == moved)
|
|
4114
|
+
inAtomic = moved;
|
|
4115
|
+
}
|
|
4116
|
+
if (inAtomic > -1) {
|
|
4117
|
+
tr = {
|
|
4118
|
+
changes: change,
|
|
4119
|
+
selection: state.EditorSelection.cursor(change.from + change.insert.length, -1)
|
|
4120
|
+
};
|
|
4121
|
+
}
|
|
4122
|
+
else if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 &&
|
|
4083
4123
|
(!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) &&
|
|
4084
4124
|
view.inputState.composing < 0) {
|
|
4085
4125
|
let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : "";
|
|
@@ -4514,31 +4554,8 @@ class MouseSelection {
|
|
|
4514
4554
|
if (this.dragging === false)
|
|
4515
4555
|
this.select(this.lastEvent);
|
|
4516
4556
|
}
|
|
4517
|
-
skipAtoms(sel) {
|
|
4518
|
-
let ranges = null;
|
|
4519
|
-
for (let i = 0; i < sel.ranges.length; i++) {
|
|
4520
|
-
let range = sel.ranges[i], updated = null;
|
|
4521
|
-
if (range.empty) {
|
|
4522
|
-
let pos = skipAtomicRanges(this.atoms, range.from, 0);
|
|
4523
|
-
if (pos != range.from)
|
|
4524
|
-
updated = state.EditorSelection.cursor(pos, -1);
|
|
4525
|
-
}
|
|
4526
|
-
else {
|
|
4527
|
-
let from = skipAtomicRanges(this.atoms, range.from, -1);
|
|
4528
|
-
let to = skipAtomicRanges(this.atoms, range.to, 1);
|
|
4529
|
-
if (from != range.from || to != range.to)
|
|
4530
|
-
updated = state.EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to);
|
|
4531
|
-
}
|
|
4532
|
-
if (updated) {
|
|
4533
|
-
if (!ranges)
|
|
4534
|
-
ranges = sel.ranges.slice();
|
|
4535
|
-
ranges[i] = updated;
|
|
4536
|
-
}
|
|
4537
|
-
}
|
|
4538
|
-
return ranges ? state.EditorSelection.create(ranges, sel.mainIndex) : sel;
|
|
4539
|
-
}
|
|
4540
4557
|
select(event) {
|
|
4541
|
-
let { view } = this, selection = this.
|
|
4558
|
+
let { view } = this, selection = skipAtomsForSelection(this.atoms, this.style.get(event, this.extend, this.multiple));
|
|
4542
4559
|
if (this.mustSelect || !selection.eq(view.state.selection, this.dragging === false))
|
|
4543
4560
|
this.view.dispatch({
|
|
4544
4561
|
selection,
|
|
@@ -4691,6 +4708,9 @@ handlers.mousedown = (view, event) => {
|
|
|
4691
4708
|
return mouseSel.dragging === false;
|
|
4692
4709
|
}
|
|
4693
4710
|
}
|
|
4711
|
+
else {
|
|
4712
|
+
view.inputState.setSelectionOrigin("select.pointer");
|
|
4713
|
+
}
|
|
4694
4714
|
return false;
|
|
4695
4715
|
};
|
|
4696
4716
|
function rangeForClick(view, pos, bias, type) {
|
|
@@ -8016,7 +8036,7 @@ class EditorView {
|
|
|
8016
8036
|
}
|
|
8017
8037
|
/**
|
|
8018
8038
|
Find the line block (see
|
|
8019
|
-
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
|
|
8039
|
+
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt)) at the given
|
|
8020
8040
|
height, again interpreted relative to the [top of the
|
|
8021
8041
|
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
|
|
8022
8042
|
*/
|
|
@@ -8803,7 +8823,7 @@ function runHandlers(map, event, view, scope) {
|
|
|
8803
8823
|
// Ctrl-Alt may be used for AltGr on Windows
|
|
8804
8824
|
!(browser.windows && event.ctrlKey && event.altKey) &&
|
|
8805
8825
|
// Alt-combinations on macOS tend to be typed characters
|
|
8806
|
-
!(browser.mac && event.altKey && !event.ctrlKey) &&
|
|
8826
|
+
!(browser.mac && event.altKey && !(event.ctrlKey || event.metaKey)) &&
|
|
8807
8827
|
(baseName = w3cKeyname.base[event.keyCode]) && baseName != name) {
|
|
8808
8828
|
if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) {
|
|
8809
8829
|
handled = true;
|
|
@@ -9078,6 +9098,8 @@ class LayerView {
|
|
|
9078
9098
|
old = next;
|
|
9079
9099
|
}
|
|
9080
9100
|
this.drawn = markers;
|
|
9101
|
+
if (browser.ios) // Issue #1600
|
|
9102
|
+
this.dom.style.display = this.dom.firstChild ? "" : "none";
|
|
9081
9103
|
}
|
|
9082
9104
|
}
|
|
9083
9105
|
destroy() {
|
package/dist/index.d.cts
CHANGED
|
@@ -871,7 +871,7 @@ declare class EditorView {
|
|
|
871
871
|
elementAtHeight(height: number): BlockInfo;
|
|
872
872
|
/**
|
|
873
873
|
Find the line block (see
|
|
874
|
-
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
|
|
874
|
+
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt)) at the given
|
|
875
875
|
height, again interpreted relative to the [top of the
|
|
876
876
|
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
|
|
877
877
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -871,7 +871,7 @@ declare class EditorView {
|
|
|
871
871
|
elementAtHeight(height: number): BlockInfo;
|
|
872
872
|
/**
|
|
873
873
|
Find the line block (see
|
|
874
|
-
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
|
|
874
|
+
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt)) at the given
|
|
875
875
|
height, again interpreted relative to the [top of the
|
|
876
876
|
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
|
|
877
877
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1783,13 +1783,14 @@ class ContentBuilder {
|
|
|
1783
1783
|
this.textOff = 0;
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
let
|
|
1786
|
+
let remaining = Math.min(this.text.length - this.textOff, length);
|
|
1787
|
+
let take = Math.min(remaining, 512 /* T.Chunk */);
|
|
1787
1788
|
this.flushBuffer(active.slice(active.length - openStart));
|
|
1788
1789
|
this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);
|
|
1789
1790
|
this.atCursorPos = true;
|
|
1790
1791
|
this.textOff += take;
|
|
1791
1792
|
length -= take;
|
|
1792
|
-
openStart = 0;
|
|
1793
|
+
openStart = remaining <= take ? 0 : active.length;
|
|
1793
1794
|
}
|
|
1794
1795
|
}
|
|
1795
1796
|
span(from, to, active, openStart) {
|
|
@@ -3603,14 +3604,13 @@ function posAtCoords(view, coords, precise, bias = -1) {
|
|
|
3603
3604
|
}
|
|
3604
3605
|
else if (doc.caretRangeFromPoint) {
|
|
3605
3606
|
let range = doc.caretRangeFromPoint(x, y);
|
|
3606
|
-
if (range)
|
|
3607
|
+
if (range)
|
|
3607
3608
|
({ startContainer: node, startOffset: offset } = range);
|
|
3608
|
-
if (!view.contentDOM.contains(node) ||
|
|
3609
|
-
browser.safari && isSuspiciousSafariCaretResult(node, offset, x) ||
|
|
3610
|
-
browser.chrome && isSuspiciousChromeCaretResult(node, offset, x))
|
|
3611
|
-
node = undefined;
|
|
3612
|
-
}
|
|
3613
3609
|
}
|
|
3610
|
+
if (node && (!view.contentDOM.contains(node) ||
|
|
3611
|
+
browser.safari && isSuspiciousSafariCaretResult(node, offset, x) ||
|
|
3612
|
+
browser.chrome && isSuspiciousChromeCaretResult(node, offset, x)))
|
|
3613
|
+
node = undefined;
|
|
3614
3614
|
// Chrome will return offsets into <input> elements without child
|
|
3615
3615
|
// nodes, which will lead to a null deref below, so clip the
|
|
3616
3616
|
// offset to the node size.
|
|
@@ -3646,11 +3646,7 @@ function posAtCoordsImprecise(view, contentRect, block, x, y) {
|
|
|
3646
3646
|
let content = view.state.sliceDoc(block.from, block.to);
|
|
3647
3647
|
return block.from + findColumn(content, into, view.state.tabSize);
|
|
3648
3648
|
}
|
|
3649
|
-
|
|
3650
|
-
// the space between lines as belonging to the last character of the
|
|
3651
|
-
// line before. This is used to detect such a result so that it can be
|
|
3652
|
-
// ignored (issue #401).
|
|
3653
|
-
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3649
|
+
function isEndOfLineBefore(node, offset, x) {
|
|
3654
3650
|
let len, scan = node;
|
|
3655
3651
|
if (node.nodeType != 3 || offset != (len = node.nodeValue.length))
|
|
3656
3652
|
return false;
|
|
@@ -3670,10 +3666,17 @@ function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
|
3670
3666
|
}
|
|
3671
3667
|
return textRange(node, len - 1, len).getBoundingClientRect().right > x;
|
|
3672
3668
|
}
|
|
3669
|
+
// In case of a high line height, Safari's caretRangeFromPoint treats
|
|
3670
|
+
// the space between lines as belonging to the last character of the
|
|
3671
|
+
// line before. This is used to detect such a result so that it can be
|
|
3672
|
+
// ignored (issue #401).
|
|
3673
|
+
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3674
|
+
return isEndOfLineBefore(node, offset, x);
|
|
3675
|
+
}
|
|
3673
3676
|
// Chrome will move positions between lines to the start of the next line
|
|
3674
3677
|
function isSuspiciousChromeCaretResult(node, offset, x) {
|
|
3675
3678
|
if (offset != 0)
|
|
3676
|
-
return
|
|
3679
|
+
return isEndOfLineBefore(node, offset, x);
|
|
3677
3680
|
for (let cur = node;;) {
|
|
3678
3681
|
let parent = cur.parentNode;
|
|
3679
3682
|
if (!parent || parent.nodeType != 1 || parent.firstChild != cur)
|
|
@@ -3798,6 +3801,29 @@ function skipAtomicRanges(atoms, pos, bias) {
|
|
|
3798
3801
|
return pos;
|
|
3799
3802
|
}
|
|
3800
3803
|
}
|
|
3804
|
+
function skipAtomsForSelection(atoms, sel) {
|
|
3805
|
+
let ranges = null;
|
|
3806
|
+
for (let i = 0; i < sel.ranges.length; i++) {
|
|
3807
|
+
let range = sel.ranges[i], updated = null;
|
|
3808
|
+
if (range.empty) {
|
|
3809
|
+
let pos = skipAtomicRanges(atoms, range.from, 0);
|
|
3810
|
+
if (pos != range.from)
|
|
3811
|
+
updated = EditorSelection.cursor(pos, -1);
|
|
3812
|
+
}
|
|
3813
|
+
else {
|
|
3814
|
+
let from = skipAtomicRanges(atoms, range.from, -1);
|
|
3815
|
+
let to = skipAtomicRanges(atoms, range.to, 1);
|
|
3816
|
+
if (from != range.from || to != range.to)
|
|
3817
|
+
updated = EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to);
|
|
3818
|
+
}
|
|
3819
|
+
if (updated) {
|
|
3820
|
+
if (!ranges)
|
|
3821
|
+
ranges = sel.ranges.slice();
|
|
3822
|
+
ranges[i] = updated;
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
return ranges ? EditorSelection.create(ranges, sel.mainIndex) : sel;
|
|
3826
|
+
}
|
|
3801
3827
|
function skipAtoms(view, oldPos, pos) {
|
|
3802
3828
|
let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map(f => f(view)), pos.from, oldPos.head > pos.from ? -1 : 1);
|
|
3803
3829
|
return newPos == pos.from ? pos : EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1);
|
|
@@ -4033,6 +4059,8 @@ function applyDOMChange(view, domChange) {
|
|
|
4033
4059
|
if (view.inputState.lastSelectionOrigin == "select")
|
|
4034
4060
|
scrollIntoView = true;
|
|
4035
4061
|
userEvent = view.inputState.lastSelectionOrigin;
|
|
4062
|
+
if (userEvent == "select.pointer")
|
|
4063
|
+
newSel = skipAtomsForSelection(view.state.facet(atomicRanges).map(f => f(view)), newSel);
|
|
4036
4064
|
}
|
|
4037
4065
|
view.dispatch({ selection: newSel, scrollIntoView, userEvent });
|
|
4038
4066
|
return true;
|
|
@@ -4074,8 +4102,20 @@ function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
|
4074
4102
|
return true;
|
|
4075
4103
|
}
|
|
4076
4104
|
function applyDefaultInsert(view, change, newSel) {
|
|
4077
|
-
let tr, startState = view.state, sel = startState.selection.main;
|
|
4078
|
-
if (change.from
|
|
4105
|
+
let tr, startState = view.state, sel = startState.selection.main, inAtomic = -1;
|
|
4106
|
+
if (change.from == change.to && change.from < sel.from || change.from > sel.to) {
|
|
4107
|
+
let side = change.from < sel.from ? -1 : 1, pos = side < 0 ? sel.from : sel.to;
|
|
4108
|
+
let moved = skipAtomicRanges(startState.facet(atomicRanges).map(f => f(view)), pos, side);
|
|
4109
|
+
if (change.from == moved)
|
|
4110
|
+
inAtomic = moved;
|
|
4111
|
+
}
|
|
4112
|
+
if (inAtomic > -1) {
|
|
4113
|
+
tr = {
|
|
4114
|
+
changes: change,
|
|
4115
|
+
selection: EditorSelection.cursor(change.from + change.insert.length, -1)
|
|
4116
|
+
};
|
|
4117
|
+
}
|
|
4118
|
+
else if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 &&
|
|
4079
4119
|
(!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) &&
|
|
4080
4120
|
view.inputState.composing < 0) {
|
|
4081
4121
|
let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : "";
|
|
@@ -4510,31 +4550,8 @@ class MouseSelection {
|
|
|
4510
4550
|
if (this.dragging === false)
|
|
4511
4551
|
this.select(this.lastEvent);
|
|
4512
4552
|
}
|
|
4513
|
-
skipAtoms(sel) {
|
|
4514
|
-
let ranges = null;
|
|
4515
|
-
for (let i = 0; i < sel.ranges.length; i++) {
|
|
4516
|
-
let range = sel.ranges[i], updated = null;
|
|
4517
|
-
if (range.empty) {
|
|
4518
|
-
let pos = skipAtomicRanges(this.atoms, range.from, 0);
|
|
4519
|
-
if (pos != range.from)
|
|
4520
|
-
updated = EditorSelection.cursor(pos, -1);
|
|
4521
|
-
}
|
|
4522
|
-
else {
|
|
4523
|
-
let from = skipAtomicRanges(this.atoms, range.from, -1);
|
|
4524
|
-
let to = skipAtomicRanges(this.atoms, range.to, 1);
|
|
4525
|
-
if (from != range.from || to != range.to)
|
|
4526
|
-
updated = EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to);
|
|
4527
|
-
}
|
|
4528
|
-
if (updated) {
|
|
4529
|
-
if (!ranges)
|
|
4530
|
-
ranges = sel.ranges.slice();
|
|
4531
|
-
ranges[i] = updated;
|
|
4532
|
-
}
|
|
4533
|
-
}
|
|
4534
|
-
return ranges ? EditorSelection.create(ranges, sel.mainIndex) : sel;
|
|
4535
|
-
}
|
|
4536
4553
|
select(event) {
|
|
4537
|
-
let { view } = this, selection = this.
|
|
4554
|
+
let { view } = this, selection = skipAtomsForSelection(this.atoms, this.style.get(event, this.extend, this.multiple));
|
|
4538
4555
|
if (this.mustSelect || !selection.eq(view.state.selection, this.dragging === false))
|
|
4539
4556
|
this.view.dispatch({
|
|
4540
4557
|
selection,
|
|
@@ -4687,6 +4704,9 @@ handlers.mousedown = (view, event) => {
|
|
|
4687
4704
|
return mouseSel.dragging === false;
|
|
4688
4705
|
}
|
|
4689
4706
|
}
|
|
4707
|
+
else {
|
|
4708
|
+
view.inputState.setSelectionOrigin("select.pointer");
|
|
4709
|
+
}
|
|
4690
4710
|
return false;
|
|
4691
4711
|
};
|
|
4692
4712
|
function rangeForClick(view, pos, bias, type) {
|
|
@@ -8011,7 +8031,7 @@ class EditorView {
|
|
|
8011
8031
|
}
|
|
8012
8032
|
/**
|
|
8013
8033
|
Find the line block (see
|
|
8014
|
-
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
|
|
8034
|
+
[`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt)) at the given
|
|
8015
8035
|
height, again interpreted relative to the [top of the
|
|
8016
8036
|
document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
|
|
8017
8037
|
*/
|
|
@@ -8798,7 +8818,7 @@ function runHandlers(map, event, view, scope) {
|
|
|
8798
8818
|
// Ctrl-Alt may be used for AltGr on Windows
|
|
8799
8819
|
!(browser.windows && event.ctrlKey && event.altKey) &&
|
|
8800
8820
|
// Alt-combinations on macOS tend to be typed characters
|
|
8801
|
-
!(browser.mac && event.altKey && !event.ctrlKey) &&
|
|
8821
|
+
!(browser.mac && event.altKey && !(event.ctrlKey || event.metaKey)) &&
|
|
8802
8822
|
(baseName = base[event.keyCode]) && baseName != name) {
|
|
8803
8823
|
if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) {
|
|
8804
8824
|
handled = true;
|
|
@@ -9073,6 +9093,8 @@ class LayerView {
|
|
|
9073
9093
|
old = next;
|
|
9074
9094
|
}
|
|
9075
9095
|
this.drawn = markers;
|
|
9096
|
+
if (browser.ios) // Issue #1600
|
|
9097
|
+
this.dom.style.display = this.dom.firstChild ? "" : "none";
|
|
9076
9098
|
}
|
|
9077
9099
|
}
|
|
9078
9100
|
destroy() {
|