@codemirror/view 6.13.1 → 6.13.2
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 +6 -0
- package/dist/index.cjs +6 -5
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6837,15 +6837,16 @@ class EditorView {
|
|
|
6837
6837
|
if (flush)
|
|
6838
6838
|
this.observer.forceFlush();
|
|
6839
6839
|
let updated = null;
|
|
6840
|
-
let sDOM = this.scrollDOM, {
|
|
6840
|
+
let sDOM = this.scrollDOM, { scrollTop } = sDOM;
|
|
6841
|
+
let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
|
|
6841
6842
|
this.viewState.scrollAnchorHeight = -1;
|
|
6842
|
-
if (scrollAnchorHeight < 0 ||
|
|
6843
|
-
if (
|
|
6843
|
+
if (scrollAnchorHeight < 0 || scrollTop != this.viewState.scrollTop) {
|
|
6844
|
+
if (scrollTop > sDOM.scrollHeight - sDOM.clientHeight - 4) {
|
|
6844
6845
|
scrollAnchorPos = -1;
|
|
6845
6846
|
scrollAnchorHeight = this.viewState.heightMap.height;
|
|
6846
6847
|
}
|
|
6847
6848
|
else {
|
|
6848
|
-
let block = this.viewState.lineBlockAtHeight(
|
|
6849
|
+
let block = this.viewState.lineBlockAtHeight(scrollTop);
|
|
6849
6850
|
scrollAnchorPos = block.from;
|
|
6850
6851
|
scrollAnchorHeight = block.top;
|
|
6851
6852
|
}
|
|
@@ -6911,7 +6912,7 @@ class EditorView {
|
|
|
6911
6912
|
this.viewState.lineBlockAt(scrollAnchorPos).top;
|
|
6912
6913
|
let diff = newAnchorHeight - scrollAnchorHeight;
|
|
6913
6914
|
if (diff > 1 || diff < -1) {
|
|
6914
|
-
sDOM.scrollTop
|
|
6915
|
+
sDOM.scrollTop = scrollTop + diff;
|
|
6915
6916
|
scrolled = true;
|
|
6916
6917
|
}
|
|
6917
6918
|
}
|
package/dist/index.js
CHANGED
|
@@ -6830,15 +6830,16 @@ class EditorView {
|
|
|
6830
6830
|
if (flush)
|
|
6831
6831
|
this.observer.forceFlush();
|
|
6832
6832
|
let updated = null;
|
|
6833
|
-
let sDOM = this.scrollDOM, {
|
|
6833
|
+
let sDOM = this.scrollDOM, { scrollTop } = sDOM;
|
|
6834
|
+
let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
|
|
6834
6835
|
this.viewState.scrollAnchorHeight = -1;
|
|
6835
|
-
if (scrollAnchorHeight < 0 ||
|
|
6836
|
-
if (
|
|
6836
|
+
if (scrollAnchorHeight < 0 || scrollTop != this.viewState.scrollTop) {
|
|
6837
|
+
if (scrollTop > sDOM.scrollHeight - sDOM.clientHeight - 4) {
|
|
6837
6838
|
scrollAnchorPos = -1;
|
|
6838
6839
|
scrollAnchorHeight = this.viewState.heightMap.height;
|
|
6839
6840
|
}
|
|
6840
6841
|
else {
|
|
6841
|
-
let block = this.viewState.lineBlockAtHeight(
|
|
6842
|
+
let block = this.viewState.lineBlockAtHeight(scrollTop);
|
|
6842
6843
|
scrollAnchorPos = block.from;
|
|
6843
6844
|
scrollAnchorHeight = block.top;
|
|
6844
6845
|
}
|
|
@@ -6904,7 +6905,7 @@ class EditorView {
|
|
|
6904
6905
|
this.viewState.lineBlockAt(scrollAnchorPos).top;
|
|
6905
6906
|
let diff = newAnchorHeight - scrollAnchorHeight;
|
|
6906
6907
|
if (diff > 1 || diff < -1) {
|
|
6907
|
-
sDOM.scrollTop
|
|
6908
|
+
sDOM.scrollTop = scrollTop + diff;
|
|
6908
6909
|
scrolled = true;
|
|
6909
6910
|
}
|
|
6910
6911
|
}
|