@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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.13.2 (2023-06-13)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue in scroll position stabilization for changes above the visible, where Chrome already does this natively and we ended up compensating twice.
6
+
1
7
  ## 6.13.1 (2023-06-12)
2
8
 
3
9
  ### Bug fixes
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, { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
6840
+ let sDOM = this.scrollDOM, { scrollTop } = sDOM;
6841
+ let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
6841
6842
  this.viewState.scrollAnchorHeight = -1;
6842
- if (scrollAnchorHeight < 0 || sDOM.scrollTop != this.viewState.scrollTop) {
6843
- if (sDOM.scrollTop > sDOM.scrollHeight - sDOM.clientHeight - 4) {
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(sDOM.scrollTop);
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 += diff;
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, { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
6833
+ let sDOM = this.scrollDOM, { scrollTop } = sDOM;
6834
+ let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
6834
6835
  this.viewState.scrollAnchorHeight = -1;
6835
- if (scrollAnchorHeight < 0 || sDOM.scrollTop != this.viewState.scrollTop) {
6836
- if (sDOM.scrollTop > sDOM.scrollHeight - sDOM.clientHeight - 4) {
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(sDOM.scrollTop);
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 += diff;
6908
+ sDOM.scrollTop = scrollTop + diff;
6908
6909
  scrolled = true;
6909
6910
  }
6910
6911
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.13.1",
3
+ "version": "6.13.2",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",