@codemirror/view 6.4.1 → 6.4.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,13 @@
1
+ ## 6.4.2 (2022-11-10)
2
+
3
+ ### Bug fixes
4
+
5
+ Typing into a read-only editor no longer moves the cursor.
6
+
7
+ Fix an issue where hover tooltips were closed when the mouse was moved over them if they had a custom parent element.
8
+
9
+ Fix an issue where the editor could end up displaying incorrect height measurements (typically after initializing).
10
+
1
11
  ## 6.4.1 (2022-11-07)
2
12
 
3
13
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -4918,9 +4918,7 @@ class ViewState {
4918
4918
  oracle.heightChanged = false;
4919
4919
  for (let vp of this.viewports) {
4920
4920
  let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);
4921
- this.heightMap = refresh
4922
- ? HeightMap.empty().applyChanges(this.stateDeco, state.Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)])
4923
- : this.heightMap.updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
4921
+ this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, state.Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
4924
4922
  }
4925
4923
  if (oracle.heightChanged)
4926
4924
  result |= 2 /* UpdateFlag.Height */;
@@ -5486,7 +5484,8 @@ class DOMChange {
5486
5484
  this.bounds = null;
5487
5485
  this.text = "";
5488
5486
  let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView;
5489
- if (start > -1 && !view.state.readOnly && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
5487
+ if (view.state.readOnly && start > -1) ;
5488
+ else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
5490
5489
  let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
5491
5490
  let reader = new DOMReader(selPoints, view.state);
5492
5491
  reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
@@ -8570,10 +8569,10 @@ class HoverPlugin {
8570
8569
  }
8571
8570
  }
8572
8571
  }
8573
- mouseleave() {
8572
+ mouseleave(e) {
8574
8573
  clearTimeout(this.hoverTimeout);
8575
8574
  this.hoverTimeout = -1;
8576
- if (this.active)
8575
+ if (this.active && !isInTooltip(e.relatedTarget))
8577
8576
  this.view.dispatch({ effects: this.setHover.of(null) });
8578
8577
  }
8579
8578
  destroy() {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Text, RangeSet, MapMode, RangeValue, Facet, StateEffect, ChangeSet, findClusterBreak, EditorSelection, EditorState, findColumn, CharCategory, Prec, Transaction, codePointAt, codePointSize, combineConfig, StateField, RangeSetBuilder, countColumn } from '@codemirror/state';
1
+ import { Text, RangeSet, MapMode, RangeValue, Facet, StateEffect, ChangeSet, findClusterBreak, EditorSelection, EditorState, findColumn, CharCategory, Transaction, Prec, codePointAt, codePointSize, combineConfig, StateField, RangeSetBuilder, countColumn } from '@codemirror/state';
2
2
  import { StyleModule } from 'style-mod';
3
3
  import { keyName, base, shift } from 'w3c-keyname';
4
4
 
@@ -4911,9 +4911,7 @@ class ViewState {
4911
4911
  oracle.heightChanged = false;
4912
4912
  for (let vp of this.viewports) {
4913
4913
  let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);
4914
- this.heightMap = refresh
4915
- ? HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)])
4916
- : this.heightMap.updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
4914
+ this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));
4917
4915
  }
4918
4916
  if (oracle.heightChanged)
4919
4917
  result |= 2 /* UpdateFlag.Height */;
@@ -5479,7 +5477,8 @@ class DOMChange {
5479
5477
  this.bounds = null;
5480
5478
  this.text = "";
5481
5479
  let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView;
5482
- if (start > -1 && !view.state.readOnly && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
5480
+ if (view.state.readOnly && start > -1) ;
5481
+ else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {
5483
5482
  let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
5484
5483
  let reader = new DOMReader(selPoints, view.state);
5485
5484
  reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
@@ -8563,10 +8562,10 @@ class HoverPlugin {
8563
8562
  }
8564
8563
  }
8565
8564
  }
8566
- mouseleave() {
8565
+ mouseleave(e) {
8567
8566
  clearTimeout(this.hoverTimeout);
8568
8567
  this.hoverTimeout = -1;
8569
- if (this.active)
8568
+ if (this.active && !isInTooltip(e.relatedTarget))
8570
8569
  this.view.dispatch({ effects: this.setHover.of(null) });
8571
8570
  }
8572
8571
  destroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.4.1",
3
+ "version": "6.4.2",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",