@codemirror/view 0.19.42 → 0.19.43
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 +11 -1
- package/dist/index.cjs +15 -24
- package/dist/index.js +15 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.19.43 (2022-02-16)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix several issues where editing or composition went wrong due to our zero-width space kludge characters ending up in unexpected places.
|
|
6
|
+
|
|
7
|
+
Make sure the editor re-measures its dimensions whenever its theme changes.
|
|
8
|
+
|
|
9
|
+
Fix an issue where some keys on Android phones could leave the editor DOM unsynced with the actual document.
|
|
10
|
+
|
|
1
11
|
## 0.19.42 (2022-02-05)
|
|
2
12
|
|
|
3
13
|
### Bug fixes
|
|
@@ -88,7 +98,7 @@ Fix an issue where backspacing out a selection on Chrome Android would sometimes
|
|
|
88
98
|
|
|
89
99
|
### Bug fixes
|
|
90
100
|
|
|
91
|
-
Fix a bug where content line elements would in some cases lose their `cm-line` class.
|
|
101
|
+
Fix a bug where content line elements would in some cases lose their `cm-line` class.
|
|
92
102
|
|
|
93
103
|
## 0.19.33 (2021-12-16)
|
|
94
104
|
|
package/dist/index.cjs
CHANGED
|
@@ -859,9 +859,6 @@ class CompositionView extends WidgetView {
|
|
|
859
859
|
coordsAt(pos, side) { return textCoords(this.widget.text, pos, side); }
|
|
860
860
|
get isEditable() { return true; }
|
|
861
861
|
}
|
|
862
|
-
// Use two characters on Android, to prevent Chrome from closing the
|
|
863
|
-
// virtual keyboard when backspacing after a widget (#602).
|
|
864
|
-
const ZeroWidthSpace = browser.android ? "\u200b\u200b" : "\u200b";
|
|
865
862
|
// These are drawn around uneditable widgets to avoid a number of
|
|
866
863
|
// browser bugs that show up when the cursor is directly next to
|
|
867
864
|
// uneditable inline content.
|
|
@@ -877,21 +874,21 @@ class WidgetBufferView extends ContentView {
|
|
|
877
874
|
}
|
|
878
875
|
split() { return new WidgetBufferView(this.side); }
|
|
879
876
|
sync() {
|
|
880
|
-
if (!this.dom)
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
this.dom
|
|
877
|
+
if (!this.dom) {
|
|
878
|
+
let dom = document.createElement("img");
|
|
879
|
+
dom.className = "cm-widgetBuffer";
|
|
880
|
+
this.setDOM(dom);
|
|
881
|
+
}
|
|
884
882
|
}
|
|
885
883
|
getSide() { return this.side; }
|
|
886
884
|
domAtPos(pos) { return DOMPos.before(this.dom); }
|
|
887
885
|
localPosFromDOM() { return 0; }
|
|
888
886
|
domBoundsAround() { return null; }
|
|
889
887
|
coordsAt(pos) {
|
|
890
|
-
|
|
891
|
-
return rects[rects.length - 1] || null;
|
|
888
|
+
return this.dom.getBoundingClientRect();
|
|
892
889
|
}
|
|
893
890
|
get overrideDOMText() {
|
|
894
|
-
return text.Text.
|
|
891
|
+
return text.Text.empty;
|
|
895
892
|
}
|
|
896
893
|
}
|
|
897
894
|
TextView.prototype.children = WidgetView.prototype.children = WidgetBufferView.prototype.children = noChildren;
|
|
@@ -5199,6 +5196,10 @@ const baseTheme = buildTheme("." + baseThemeID, {
|
|
|
5199
5196
|
overflow: "hidden",
|
|
5200
5197
|
verticalAlign: "bottom"
|
|
5201
5198
|
},
|
|
5199
|
+
".cm-widgetBuffer": {
|
|
5200
|
+
verticalAlign: "text-bottom",
|
|
5201
|
+
height: "1em",
|
|
5202
|
+
},
|
|
5202
5203
|
".cm-placeholder": {
|
|
5203
5204
|
color: "#888",
|
|
5204
5205
|
display: "inline-block",
|
|
@@ -5447,7 +5448,7 @@ class DOMObserver {
|
|
|
5447
5448
|
}
|
|
5448
5449
|
// Throw away any pending changes
|
|
5449
5450
|
clear() {
|
|
5450
|
-
this.
|
|
5451
|
+
this.processRecords();
|
|
5451
5452
|
this.queue.length = 0;
|
|
5452
5453
|
this.selectionChanged = false;
|
|
5453
5454
|
}
|
|
@@ -5625,23 +5626,11 @@ function applyDOMChange(view, start, end, typeOver) {
|
|
|
5625
5626
|
}
|
|
5626
5627
|
let diff = findDiff(view.state.doc.sliceString(from, to, LineBreakPlaceholder), reader.text, preferredPos - from, preferredSide);
|
|
5627
5628
|
if (diff) {
|
|
5628
|
-
let orig = diff;
|
|
5629
5629
|
// Chrome inserts two newlines when pressing shift-enter at the
|
|
5630
5630
|
// end of a line. This drops one of those.
|
|
5631
5631
|
if (browser.chrome && view.inputState.lastKeyCode == 13 &&
|
|
5632
5632
|
diff.toB == diff.from + 2 && reader.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
5633
5633
|
diff.toB--;
|
|
5634
|
-
// Strip leading and trailing zero-width spaces from the inserted
|
|
5635
|
-
// content, to work around widget buffers being moved into text
|
|
5636
|
-
// nodes by the browser.
|
|
5637
|
-
while (diff.from < diff.toB && reader.text[diff.from] == "\u200b") {
|
|
5638
|
-
diff = { from: diff.from + 1, toA: diff.toA, toB: diff.toB };
|
|
5639
|
-
selPoints.forEach(p => p.pos -= p.pos > orig.from ? 1 : 0);
|
|
5640
|
-
}
|
|
5641
|
-
while (diff.toB > diff.from && reader.text[diff.toB - 1] == "\u200b") {
|
|
5642
|
-
diff = { from: diff.from, toA: diff.toA, toB: diff.toB - 1 };
|
|
5643
|
-
selPoints.forEach(p => p.pos -= p.pos > orig.toB ? 1 : 0);
|
|
5644
|
-
}
|
|
5645
5634
|
change = { from: from + diff.from, to: from + diff.toA,
|
|
5646
5635
|
insert: state.Text.of(reader.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
|
5647
5636
|
}
|
|
@@ -5992,7 +5981,9 @@ class EditorView {
|
|
|
5992
5981
|
finally {
|
|
5993
5982
|
this.updateState = 0 /* Idle */;
|
|
5994
5983
|
}
|
|
5995
|
-
if (
|
|
5984
|
+
if (update.startState.facet(theme) != update.state.facet(theme))
|
|
5985
|
+
this.viewState.mustMeasureContent = true;
|
|
5986
|
+
if (redrawn || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent)
|
|
5996
5987
|
this.requestMeasure();
|
|
5997
5988
|
if (!update.empty)
|
|
5998
5989
|
for (let listener of this.state.facet(updateListener))
|
package/dist/index.js
CHANGED
|
@@ -856,9 +856,6 @@ class CompositionView extends WidgetView {
|
|
|
856
856
|
coordsAt(pos, side) { return textCoords(this.widget.text, pos, side); }
|
|
857
857
|
get isEditable() { return true; }
|
|
858
858
|
}
|
|
859
|
-
// Use two characters on Android, to prevent Chrome from closing the
|
|
860
|
-
// virtual keyboard when backspacing after a widget (#602).
|
|
861
|
-
const ZeroWidthSpace = browser.android ? "\u200b\u200b" : "\u200b";
|
|
862
859
|
// These are drawn around uneditable widgets to avoid a number of
|
|
863
860
|
// browser bugs that show up when the cursor is directly next to
|
|
864
861
|
// uneditable inline content.
|
|
@@ -874,21 +871,21 @@ class WidgetBufferView extends ContentView {
|
|
|
874
871
|
}
|
|
875
872
|
split() { return new WidgetBufferView(this.side); }
|
|
876
873
|
sync() {
|
|
877
|
-
if (!this.dom)
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
this.dom
|
|
874
|
+
if (!this.dom) {
|
|
875
|
+
let dom = document.createElement("img");
|
|
876
|
+
dom.className = "cm-widgetBuffer";
|
|
877
|
+
this.setDOM(dom);
|
|
878
|
+
}
|
|
881
879
|
}
|
|
882
880
|
getSide() { return this.side; }
|
|
883
881
|
domAtPos(pos) { return DOMPos.before(this.dom); }
|
|
884
882
|
localPosFromDOM() { return 0; }
|
|
885
883
|
domBoundsAround() { return null; }
|
|
886
884
|
coordsAt(pos) {
|
|
887
|
-
|
|
888
|
-
return rects[rects.length - 1] || null;
|
|
885
|
+
return this.dom.getBoundingClientRect();
|
|
889
886
|
}
|
|
890
887
|
get overrideDOMText() {
|
|
891
|
-
return Text.
|
|
888
|
+
return Text.empty;
|
|
892
889
|
}
|
|
893
890
|
}
|
|
894
891
|
TextView.prototype.children = WidgetView.prototype.children = WidgetBufferView.prototype.children = noChildren;
|
|
@@ -5193,6 +5190,10 @@ const baseTheme = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
5193
5190
|
overflow: "hidden",
|
|
5194
5191
|
verticalAlign: "bottom"
|
|
5195
5192
|
},
|
|
5193
|
+
".cm-widgetBuffer": {
|
|
5194
|
+
verticalAlign: "text-bottom",
|
|
5195
|
+
height: "1em",
|
|
5196
|
+
},
|
|
5196
5197
|
".cm-placeholder": {
|
|
5197
5198
|
color: "#888",
|
|
5198
5199
|
display: "inline-block",
|
|
@@ -5441,7 +5442,7 @@ class DOMObserver {
|
|
|
5441
5442
|
}
|
|
5442
5443
|
// Throw away any pending changes
|
|
5443
5444
|
clear() {
|
|
5444
|
-
this.
|
|
5445
|
+
this.processRecords();
|
|
5445
5446
|
this.queue.length = 0;
|
|
5446
5447
|
this.selectionChanged = false;
|
|
5447
5448
|
}
|
|
@@ -5619,23 +5620,11 @@ function applyDOMChange(view, start, end, typeOver) {
|
|
|
5619
5620
|
}
|
|
5620
5621
|
let diff = findDiff(view.state.doc.sliceString(from, to, LineBreakPlaceholder), reader.text, preferredPos - from, preferredSide);
|
|
5621
5622
|
if (diff) {
|
|
5622
|
-
let orig = diff;
|
|
5623
5623
|
// Chrome inserts two newlines when pressing shift-enter at the
|
|
5624
5624
|
// end of a line. This drops one of those.
|
|
5625
5625
|
if (browser.chrome && view.inputState.lastKeyCode == 13 &&
|
|
5626
5626
|
diff.toB == diff.from + 2 && reader.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)
|
|
5627
5627
|
diff.toB--;
|
|
5628
|
-
// Strip leading and trailing zero-width spaces from the inserted
|
|
5629
|
-
// content, to work around widget buffers being moved into text
|
|
5630
|
-
// nodes by the browser.
|
|
5631
|
-
while (diff.from < diff.toB && reader.text[diff.from] == "\u200b") {
|
|
5632
|
-
diff = { from: diff.from + 1, toA: diff.toA, toB: diff.toB };
|
|
5633
|
-
selPoints.forEach(p => p.pos -= p.pos > orig.from ? 1 : 0);
|
|
5634
|
-
}
|
|
5635
|
-
while (diff.toB > diff.from && reader.text[diff.toB - 1] == "\u200b") {
|
|
5636
|
-
diff = { from: diff.from, toA: diff.toA, toB: diff.toB - 1 };
|
|
5637
|
-
selPoints.forEach(p => p.pos -= p.pos > orig.toB ? 1 : 0);
|
|
5638
|
-
}
|
|
5639
5628
|
change = { from: from + diff.from, to: from + diff.toA,
|
|
5640
5629
|
insert: Text$1.of(reader.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
|
5641
5630
|
}
|
|
@@ -5986,7 +5975,9 @@ class EditorView {
|
|
|
5986
5975
|
finally {
|
|
5987
5976
|
this.updateState = 0 /* Idle */;
|
|
5988
5977
|
}
|
|
5989
|
-
if (
|
|
5978
|
+
if (update.startState.facet(theme) != update.state.facet(theme))
|
|
5979
|
+
this.viewState.mustMeasureContent = true;
|
|
5980
|
+
if (redrawn || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent)
|
|
5990
5981
|
this.requestMeasure();
|
|
5991
5982
|
if (!update.empty)
|
|
5992
5983
|
for (let listener of this.state.facet(updateListener))
|