@codemirror/view 6.1.1 → 6.1.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,11 @@
1
+ ## 6.1.2 (2022-07-27)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue where double tapping enter to confirm IME input and insert a newline on iOS would sometimes insert two newlines.
6
+
7
+ Fix an issue on iOS where a composition could get aborted if the editor scrolled on backspace.
8
+
1
9
  ## 6.1.1 (2022-07-25)
2
10
 
3
11
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -3356,10 +3356,10 @@ class InputState {
3356
3356
  event.preventDefault();
3357
3357
  else
3358
3358
  handler(view, event);
3359
- });
3359
+ }, handlerOptions[type]);
3360
3360
  this.registeredEvents.push(type);
3361
3361
  }
3362
- if (browser.chrome && browser.chrome_version >= 102) {
3362
+ if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
3363
3363
  // On Chrome 102, viewport updates somehow stop wheel-based
3364
3364
  // scrolling. Turning off pointer events during the scroll seems
3365
3365
  // to avoid the issue.
@@ -3481,7 +3481,7 @@ class InputState {
3481
3481
  // compositionend and keydown events are sometimes emitted in the
3482
3482
  // wrong order. The key event should still be ignored, even when
3483
3483
  // it happens after the compositionend event.
3484
- if (browser.safari && Date.now() - this.compositionEndedAt < 100) {
3484
+ if (browser.safari && !browser.ios && Date.now() - this.compositionEndedAt < 100) {
3485
3485
  this.compositionEndedAt = 0;
3486
3486
  return true;
3487
3487
  }
@@ -3609,6 +3609,7 @@ function eventBelongsToEditor(view, event) {
3609
3609
  return true;
3610
3610
  }
3611
3611
  const handlers = Object.create(null);
3612
+ const handlerOptions = Object.create(null);
3612
3613
  // This is very crude, but unfortunately both these browsers _pretend_
3613
3614
  // that they have a clipboard API—all the objects and methods are
3614
3615
  // there, they just don't work, and they are hard to test.
@@ -3672,6 +3673,7 @@ handlers.touchstart = (view, e) => {
3672
3673
  handlers.touchmove = view => {
3673
3674
  view.inputState.setSelectionOrigin("select.pointer");
3674
3675
  };
3676
+ handlerOptions.touchstart = handlerOptions.touchmove = { passive: true };
3675
3677
  handlers.mousedown = (view, event) => {
3676
3678
  view.observer.flush();
3677
3679
  if (view.inputState.lastTouchTime > Date.now() - 2000 && getClickType(event) == 1)
@@ -5687,8 +5689,8 @@ class DOMObserver {
5687
5689
  if (this.delayedFlush >= 0) {
5688
5690
  window.clearTimeout(this.delayedFlush);
5689
5691
  this.delayedFlush = -1;
5690
- this.flush();
5691
5692
  }
5693
+ this.flush();
5692
5694
  }
5693
5695
  processRecords() {
5694
5696
  let records = this.queue;
@@ -6280,7 +6282,7 @@ class EditorView {
6280
6282
  cancelAnimationFrame(this.measureScheduled);
6281
6283
  this.measureScheduled = 0; // Prevent requestMeasure calls from scheduling another animation frame
6282
6284
  if (flush)
6283
- this.observer.flush();
6285
+ this.observer.forceFlush();
6284
6286
  let updated = null;
6285
6287
  try {
6286
6288
  for (let i = 0;; i++) {
package/dist/index.js CHANGED
@@ -3350,10 +3350,10 @@ class InputState {
3350
3350
  event.preventDefault();
3351
3351
  else
3352
3352
  handler(view, event);
3353
- });
3353
+ }, handlerOptions[type]);
3354
3354
  this.registeredEvents.push(type);
3355
3355
  }
3356
- if (browser.chrome && browser.chrome_version >= 102) {
3356
+ if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
3357
3357
  // On Chrome 102, viewport updates somehow stop wheel-based
3358
3358
  // scrolling. Turning off pointer events during the scroll seems
3359
3359
  // to avoid the issue.
@@ -3475,7 +3475,7 @@ class InputState {
3475
3475
  // compositionend and keydown events are sometimes emitted in the
3476
3476
  // wrong order. The key event should still be ignored, even when
3477
3477
  // it happens after the compositionend event.
3478
- if (browser.safari && Date.now() - this.compositionEndedAt < 100) {
3478
+ if (browser.safari && !browser.ios && Date.now() - this.compositionEndedAt < 100) {
3479
3479
  this.compositionEndedAt = 0;
3480
3480
  return true;
3481
3481
  }
@@ -3603,6 +3603,7 @@ function eventBelongsToEditor(view, event) {
3603
3603
  return true;
3604
3604
  }
3605
3605
  const handlers = /*@__PURE__*/Object.create(null);
3606
+ const handlerOptions = /*@__PURE__*/Object.create(null);
3606
3607
  // This is very crude, but unfortunately both these browsers _pretend_
3607
3608
  // that they have a clipboard API—all the objects and methods are
3608
3609
  // there, they just don't work, and they are hard to test.
@@ -3666,6 +3667,7 @@ handlers.touchstart = (view, e) => {
3666
3667
  handlers.touchmove = view => {
3667
3668
  view.inputState.setSelectionOrigin("select.pointer");
3668
3669
  };
3670
+ handlerOptions.touchstart = handlerOptions.touchmove = { passive: true };
3669
3671
  handlers.mousedown = (view, event) => {
3670
3672
  view.observer.flush();
3671
3673
  if (view.inputState.lastTouchTime > Date.now() - 2000 && getClickType(event) == 1)
@@ -5680,8 +5682,8 @@ class DOMObserver {
5680
5682
  if (this.delayedFlush >= 0) {
5681
5683
  window.clearTimeout(this.delayedFlush);
5682
5684
  this.delayedFlush = -1;
5683
- this.flush();
5684
5685
  }
5686
+ this.flush();
5685
5687
  }
5686
5688
  processRecords() {
5687
5689
  let records = this.queue;
@@ -6273,7 +6275,7 @@ class EditorView {
6273
6275
  cancelAnimationFrame(this.measureScheduled);
6274
6276
  this.measureScheduled = 0; // Prevent requestMeasure calls from scheduling another animation frame
6275
6277
  if (flush)
6276
- this.observer.flush();
6278
+ this.observer.forceFlush();
6277
6279
  let updated = null;
6278
6280
  try {
6279
6281
  for (let i = 0;; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",