@codemirror/view 0.19.37 → 0.19.38
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 +10 -0
- package/dist/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.19.38 (2022-01-05)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a bug that caused line decorations with a `class` property to suppress all other line decorations for that line.
|
|
6
|
+
|
|
7
|
+
Fix a bug that caused scroll effects to be corrupted when further updates came in before they were applied.
|
|
8
|
+
|
|
9
|
+
Fix an issue where, depending on which way a floating point rounding error fell, `posAtCoords` (and thus vertical cursor motion) for positions outside of the vertical range of the document might or might not return the start/end of the document.
|
|
10
|
+
|
|
1
11
|
## 0.19.37 (2021-12-22)
|
|
2
12
|
|
|
3
13
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1311,7 +1311,7 @@ class LineView extends ContentView {
|
|
|
1311
1311
|
if (attrs)
|
|
1312
1312
|
this.attrs = combineAttrs(attrs, this.attrs || {});
|
|
1313
1313
|
if (cls)
|
|
1314
|
-
this.attrs = combineAttrs(
|
|
1314
|
+
this.attrs = combineAttrs({ class: cls }, this.attrs || {});
|
|
1315
1315
|
}
|
|
1316
1316
|
domAtPos(pos) {
|
|
1317
1317
|
return inlineDOMAtPos(this.dom, this.children, pos);
|
|
@@ -3005,7 +3005,11 @@ function posAtCoords(view, { x, y }, precise, bias = -1) {
|
|
|
3005
3005
|
var _a;
|
|
3006
3006
|
let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
|
|
3007
3007
|
let block, { docHeight } = view.viewState;
|
|
3008
|
-
let yOffset =
|
|
3008
|
+
let yOffset = y - docTop;
|
|
3009
|
+
if (yOffset < 0)
|
|
3010
|
+
return 0;
|
|
3011
|
+
if (yOffset > docHeight)
|
|
3012
|
+
return view.state.doc.length;
|
|
3009
3013
|
// Scan for a text block near the queried y position
|
|
3010
3014
|
for (let halfLine = view.defaultLineHeight / 2, bounced = false;;) {
|
|
3011
3015
|
block = view.elementAtHeight(yOffset);
|
|
@@ -5860,7 +5864,7 @@ class EditorView {
|
|
|
5860
5864
|
if (state$1.facet(state.EditorState.phrases) != this.state.facet(state.EditorState.phrases))
|
|
5861
5865
|
return this.setState(state$1);
|
|
5862
5866
|
update = new ViewUpdate(this, state$1, transactions);
|
|
5863
|
-
let scrollTarget =
|
|
5867
|
+
let scrollTarget = this.viewState.scrollTarget;
|
|
5864
5868
|
try {
|
|
5865
5869
|
this.updateState = 2 /* Updating */;
|
|
5866
5870
|
for (let tr of transactions) {
|
package/dist/index.js
CHANGED
|
@@ -1307,7 +1307,7 @@ class LineView extends ContentView {
|
|
|
1307
1307
|
if (attrs)
|
|
1308
1308
|
this.attrs = combineAttrs(attrs, this.attrs || {});
|
|
1309
1309
|
if (cls)
|
|
1310
|
-
this.attrs = combineAttrs(
|
|
1310
|
+
this.attrs = combineAttrs({ class: cls }, this.attrs || {});
|
|
1311
1311
|
}
|
|
1312
1312
|
domAtPos(pos) {
|
|
1313
1313
|
return inlineDOMAtPos(this.dom, this.children, pos);
|
|
@@ -3000,7 +3000,11 @@ function posAtCoords(view, { x, y }, precise, bias = -1) {
|
|
|
3000
3000
|
var _a;
|
|
3001
3001
|
let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
|
|
3002
3002
|
let block, { docHeight } = view.viewState;
|
|
3003
|
-
let yOffset =
|
|
3003
|
+
let yOffset = y - docTop;
|
|
3004
|
+
if (yOffset < 0)
|
|
3005
|
+
return 0;
|
|
3006
|
+
if (yOffset > docHeight)
|
|
3007
|
+
return view.state.doc.length;
|
|
3004
3008
|
// Scan for a text block near the queried y position
|
|
3005
3009
|
for (let halfLine = view.defaultLineHeight / 2, bounced = false;;) {
|
|
3006
3010
|
block = view.elementAtHeight(yOffset);
|
|
@@ -5854,7 +5858,7 @@ class EditorView {
|
|
|
5854
5858
|
if (state.facet(EditorState.phrases) != this.state.facet(EditorState.phrases))
|
|
5855
5859
|
return this.setState(state);
|
|
5856
5860
|
update = new ViewUpdate(this, state, transactions);
|
|
5857
|
-
let scrollTarget =
|
|
5861
|
+
let scrollTarget = this.viewState.scrollTarget;
|
|
5858
5862
|
try {
|
|
5859
5863
|
this.updateState = 2 /* Updating */;
|
|
5860
5864
|
for (let tr of transactions) {
|