@codemirror/view 0.19.43 → 0.19.44

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
+ ## 0.19.44 (2022-02-17)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a crash that occasionally occurred when drag-selecting in a way that scrolled the editor.
6
+
7
+ ### New features
8
+
9
+ The new `EditorView.compositionStarted` property indicates whether a composition is starting.
10
+
1
11
  ## 0.19.43 (2022-02-16)
2
12
 
3
13
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -935,7 +935,7 @@ function coordsInChildren(view, pos, side) {
935
935
  continue;
936
936
  flatten = side = -child.getSide();
937
937
  }
938
- let rect = child.coordsAt(pos - off, side);
938
+ let rect = child.coordsAt(Math.max(0, pos - off), side);
939
939
  return flatten && rect ? flattenRect(rect, side < 0) : rect;
940
940
  }
941
941
  off = end;
@@ -5913,9 +5913,17 @@ class EditorView {
5913
5913
  get inView() { return this.viewState.inView; }
5914
5914
  /**
5915
5915
  Indicates whether the user is currently composing text via
5916
- [IME](https://en.wikipedia.org/wiki/Input_method).
5916
+ [IME](https://en.wikipedia.org/wiki/Input_method), and at least
5917
+ one change has been made in the current composition.
5917
5918
  */
5918
5919
  get composing() { return this.inputState.composing > 0; }
5920
+ /**
5921
+ Indicates whether the user is currently in composing state. Note
5922
+ that on some platforms, like Android, this will be the case a
5923
+ lot, since just putting the cursor on a word starts a
5924
+ composition there.
5925
+ */
5926
+ get compositionStarted() { return this.inputState.composing >= 0; }
5919
5927
  dispatch(...input) {
5920
5928
  this._dispatch(input.length == 1 && input[0] instanceof state.Transaction ? input[0]
5921
5929
  : this.state.update(...input));
package/dist/index.d.ts CHANGED
@@ -676,9 +676,17 @@ declare class EditorView {
676
676
  get inView(): boolean;
677
677
  /**
678
678
  Indicates whether the user is currently composing text via
679
- [IME](https://en.wikipedia.org/wiki/Input_method).
679
+ [IME](https://en.wikipedia.org/wiki/Input_method), and at least
680
+ one change has been made in the current composition.
680
681
  */
681
682
  get composing(): boolean;
683
+ /**
684
+ Indicates whether the user is currently in composing state. Note
685
+ that on some platforms, like Android, this will be the case a
686
+ lot, since just putting the cursor on a word starts a
687
+ composition there.
688
+ */
689
+ get compositionStarted(): boolean;
682
690
  private _dispatch;
683
691
  /**
684
692
  The document or shadow root that the view lives in.
package/dist/index.js CHANGED
@@ -932,7 +932,7 @@ function coordsInChildren(view, pos, side) {
932
932
  continue;
933
933
  flatten = side = -child.getSide();
934
934
  }
935
- let rect = child.coordsAt(pos - off, side);
935
+ let rect = child.coordsAt(Math.max(0, pos - off), side);
936
936
  return flatten && rect ? flattenRect(rect, side < 0) : rect;
937
937
  }
938
938
  off = end;
@@ -5907,9 +5907,17 @@ class EditorView {
5907
5907
  get inView() { return this.viewState.inView; }
5908
5908
  /**
5909
5909
  Indicates whether the user is currently composing text via
5910
- [IME](https://en.wikipedia.org/wiki/Input_method).
5910
+ [IME](https://en.wikipedia.org/wiki/Input_method), and at least
5911
+ one change has been made in the current composition.
5911
5912
  */
5912
5913
  get composing() { return this.inputState.composing > 0; }
5914
+ /**
5915
+ Indicates whether the user is currently in composing state. Note
5916
+ that on some platforms, like Android, this will be the case a
5917
+ lot, since just putting the cursor on a word starts a
5918
+ composition there.
5919
+ */
5920
+ get compositionStarted() { return this.inputState.composing >= 0; }
5913
5921
  dispatch(...input) {
5914
5922
  this._dispatch(input.length == 1 && input[0] instanceof Transaction ? input[0]
5915
5923
  : this.state.update(...input));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "0.19.43",
3
+ "version": "0.19.44",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",