@codemirror/view 6.36.2 → 6.36.3

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.36.3 (2025-02-18)
2
+
3
+ ### Bug fixes
4
+
5
+ Make sure event handlers registered with `domEventHandlers` are not called during view updates, to avoid triggering nested update errors.
6
+
7
+ Don't include the window scrollbars in the space available for displaying tooltips.
8
+
9
+ Work around an issue with Chrome's `EditContext` that shows up when using autocompletion while composing with Samsung's virtual Android keyboard.
10
+
1
11
  ## 6.36.2 (2025-01-09)
2
12
 
3
13
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -4209,7 +4209,10 @@ class InputState {
4209
4209
  return;
4210
4210
  if (event.type == "keydown" && this.keydown(event))
4211
4211
  return;
4212
- this.runHandlers(event.type, event);
4212
+ if (this.view.updateState != 0 /* UpdateState.Idle */)
4213
+ Promise.resolve().then(() => this.runHandlers(event.type, event));
4214
+ else
4215
+ this.runHandlers(event.type, event);
4213
4216
  }
4214
4217
  runHandlers(type, event) {
4215
4218
  let handlers = this.handlers[type];
@@ -7313,8 +7316,11 @@ class EditContextManager {
7313
7316
  return !abort;
7314
7317
  }
7315
7318
  update(update) {
7316
- let reverted = this.pendingContextChange;
7317
- if (this.composing && (this.composing.drifted || update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to)))) {
7319
+ let reverted = this.pendingContextChange, startSel = update.startState.selection.main;
7320
+ if (this.composing &&
7321
+ (this.composing.drifted ||
7322
+ (!update.changes.touchesRange(startSel.from, startSel.to) &&
7323
+ update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to))))) {
7318
7324
  this.composing.drifted = true;
7319
7325
  this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
7320
7326
  }
@@ -9800,8 +9806,8 @@ function tooltips(config = {}) {
9800
9806
  return tooltipConfig.of(config);
9801
9807
  }
9802
9808
  function windowSpace(view) {
9803
- let { win } = view;
9804
- return { top: 0, left: 0, bottom: win.innerHeight, right: win.innerWidth };
9809
+ let docElt = view.dom.ownerDocument.documentElement;
9810
+ return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
9805
9811
  }
9806
9812
  const tooltipConfig = state.Facet.define({
9807
9813
  combine: values => {
package/dist/index.d.cts CHANGED
@@ -1839,9 +1839,10 @@ declare function tooltips(config?: {
1839
1839
  /**
1840
1840
  By default, when figuring out whether there is room for a
1841
1841
  tooltip at a given position, the extension considers the entire
1842
- space between 0,0 and `innerWidth`,`innerHeight` to be available
1843
- for showing tooltips. You can provide a function here that
1844
- returns an alternative rectangle.
1842
+ space between 0,0 and
1843
+ `documentElement.clientWidth`/`clientHeight` to be available for
1844
+ showing tooltips. You can provide a function here that returns
1845
+ an alternative rectangle.
1845
1846
  */
1846
1847
  tooltipSpace?: (view: EditorView) => Rect;
1847
1848
  }): Extension;
package/dist/index.d.ts CHANGED
@@ -1839,9 +1839,10 @@ declare function tooltips(config?: {
1839
1839
  /**
1840
1840
  By default, when figuring out whether there is room for a
1841
1841
  tooltip at a given position, the extension considers the entire
1842
- space between 0,0 and `innerWidth`,`innerHeight` to be available
1843
- for showing tooltips. You can provide a function here that
1844
- returns an alternative rectangle.
1842
+ space between 0,0 and
1843
+ `documentElement.clientWidth`/`clientHeight` to be available for
1844
+ showing tooltips. You can provide a function here that returns
1845
+ an alternative rectangle.
1845
1846
  */
1846
1847
  tooltipSpace?: (view: EditorView) => Rect;
1847
1848
  }): Extension;
package/dist/index.js CHANGED
@@ -4205,7 +4205,10 @@ class InputState {
4205
4205
  return;
4206
4206
  if (event.type == "keydown" && this.keydown(event))
4207
4207
  return;
4208
- this.runHandlers(event.type, event);
4208
+ if (this.view.updateState != 0 /* UpdateState.Idle */)
4209
+ Promise.resolve().then(() => this.runHandlers(event.type, event));
4210
+ else
4211
+ this.runHandlers(event.type, event);
4209
4212
  }
4210
4213
  runHandlers(type, event) {
4211
4214
  let handlers = this.handlers[type];
@@ -7308,8 +7311,11 @@ class EditContextManager {
7308
7311
  return !abort;
7309
7312
  }
7310
7313
  update(update) {
7311
- let reverted = this.pendingContextChange;
7312
- if (this.composing && (this.composing.drifted || update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to)))) {
7314
+ let reverted = this.pendingContextChange, startSel = update.startState.selection.main;
7315
+ if (this.composing &&
7316
+ (this.composing.drifted ||
7317
+ (!update.changes.touchesRange(startSel.from, startSel.to) &&
7318
+ update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to))))) {
7313
7319
  this.composing.drifted = true;
7314
7320
  this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
7315
7321
  }
@@ -9795,8 +9801,8 @@ function tooltips(config = {}) {
9795
9801
  return tooltipConfig.of(config);
9796
9802
  }
9797
9803
  function windowSpace(view) {
9798
- let { win } = view;
9799
- return { top: 0, left: 0, bottom: win.innerHeight, right: win.innerWidth };
9804
+ let docElt = view.dom.ownerDocument.documentElement;
9805
+ return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
9800
9806
  }
9801
9807
  const tooltipConfig = /*@__PURE__*/Facet.define({
9802
9808
  combine: values => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.36.2",
3
+ "version": "6.36.3",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",