@codemirror/view 6.8.0 → 6.8.1

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.8.1 (2023-02-08)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue where tooltips that have their height reduced have their height flicker when scrolling or otherwise interacting with the editor.
6
+
1
7
  ## 6.8.0 (2023-02-07)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -8363,6 +8363,7 @@ const tooltipConfig = state.Facet.define({
8363
8363
  });
8364
8364
  }
8365
8365
  });
8366
+ const knownHeight = new WeakMap();
8366
8367
  const tooltipPlugin = ViewPlugin.fromClass(class {
8367
8368
  constructor(view) {
8368
8369
  this.view = view;
@@ -8478,6 +8479,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
8478
8479
  };
8479
8480
  }
8480
8481
  writeMeasure(measured) {
8482
+ var _a;
8481
8483
  let { editor, space } = measured;
8482
8484
  let others = [];
8483
8485
  for (let i = 0; i < this.manager.tooltips.length; i++) {
@@ -8493,7 +8495,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
8493
8495
  }
8494
8496
  let arrow = tooltip.arrow ? tView.dom.querySelector(".cm-tooltip-arrow") : null;
8495
8497
  let arrowHeight = arrow ? 7 /* Arrow.Size */ : 0;
8496
- let width = size.right - size.left, height = size.bottom - size.top;
8498
+ let width = size.right - size.left, height = (_a = knownHeight.get(tView)) !== null && _a !== void 0 ? _a : size.bottom - size.top;
8497
8499
  let offset = tView.offset || noOffset, ltr = this.view.textDirection == exports.Direction.LTR;
8498
8500
  let left = size.width > space.right - space.left ? (ltr ? space.left : space.right - size.width)
8499
8501
  : ltr ? Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width)
@@ -8510,6 +8512,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
8510
8512
  dom.style.top = Outside;
8511
8513
  continue;
8512
8514
  }
8515
+ knownHeight.set(tView, height);
8513
8516
  dom.style.height = (height = spaceVert) + "px";
8514
8517
  }
8515
8518
  else if (dom.style.height) {
package/dist/index.js CHANGED
@@ -8356,6 +8356,7 @@ const tooltipConfig = /*@__PURE__*/Facet.define({
8356
8356
  });
8357
8357
  }
8358
8358
  });
8359
+ const knownHeight = /*@__PURE__*/new WeakMap();
8359
8360
  const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
8360
8361
  constructor(view) {
8361
8362
  this.view = view;
@@ -8471,6 +8472,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
8471
8472
  };
8472
8473
  }
8473
8474
  writeMeasure(measured) {
8475
+ var _a;
8474
8476
  let { editor, space } = measured;
8475
8477
  let others = [];
8476
8478
  for (let i = 0; i < this.manager.tooltips.length; i++) {
@@ -8486,7 +8488,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
8486
8488
  }
8487
8489
  let arrow = tooltip.arrow ? tView.dom.querySelector(".cm-tooltip-arrow") : null;
8488
8490
  let arrowHeight = arrow ? 7 /* Arrow.Size */ : 0;
8489
- let width = size.right - size.left, height = size.bottom - size.top;
8491
+ let width = size.right - size.left, height = (_a = knownHeight.get(tView)) !== null && _a !== void 0 ? _a : size.bottom - size.top;
8490
8492
  let offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR;
8491
8493
  let left = size.width > space.right - space.left ? (ltr ? space.left : space.right - size.width)
8492
8494
  : ltr ? Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width)
@@ -8503,6 +8505,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
8503
8505
  dom.style.top = Outside;
8504
8506
  continue;
8505
8507
  }
8508
+ knownHeight.set(tView, height);
8506
8509
  dom.style.height = (height = spaceVert) + "px";
8507
8510
  }
8508
8511
  else if (dom.style.height) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.8.0",
3
+ "version": "6.8.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",