@prose-reader/core 1.137.0 → 1.139.0

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.
@@ -8599,17 +8599,26 @@
8599
8599
  this.selectionChange$ = rxjs.fromEvent(document2, "selectionchange").pipe(
8600
8600
  rxjs.map(() => document2.getSelection())
8601
8601
  );
8602
- this.selectionAfterPointerUp$ = rxjs.fromEvent(document2, "pointerup").pipe(
8603
- /**
8604
- * The selection is still valid during the event even if it will
8605
- * be discarded. The timeout make sure to detect this edge case.
8606
- */
8607
- rxjs.delay(0),
8608
- rxjs.map((event) => {
8609
- const selection = document2.getSelection();
8610
- return selection && !selection.isCollapsed ? [event, selection] : void 0;
8611
- }),
8612
- rxjs.filter(isDefined)
8602
+ this.selectionOver$ = rxjs.fromEvent(document2, "pointerdown").pipe(
8603
+ rxjs.switchMap(
8604
+ () => rxjs.merge(
8605
+ rxjs.fromEvent(document2, "pointerup"),
8606
+ rxjs.fromEvent(document2, "pointercancel"),
8607
+ rxjs.fromEvent(document2, "contextmenu")
8608
+ ).pipe(
8609
+ rxjs.first(),
8610
+ /**
8611
+ * The selection is still valid during the event even if it will
8612
+ * be discarded. The timeout make sure to detect this edge case.
8613
+ */
8614
+ rxjs.delay(0),
8615
+ rxjs.map((event) => {
8616
+ const selection = document2.getSelection();
8617
+ return selection && !selection.isCollapsed ? [event, selection] : void 0;
8618
+ }),
8619
+ rxjs.filter(isDefined)
8620
+ )
8621
+ )
8613
8622
  );
8614
8623
  }
8615
8624
  }
@@ -8618,7 +8627,7 @@
8618
8627
  const selectionSubject = new rxjs.BehaviorSubject(
8619
8628
  void 0
8620
8629
  );
8621
- const selectionWithPointerUpSubject = new rxjs.Subject();
8630
+ const selectionOverSubject = new rxjs.Subject();
8622
8631
  reader.hookManager.register(
8623
8632
  `item.onDocumentLoad`,
8624
8633
  ({ itemId, destroy$, destroy }) => {
@@ -8644,9 +8653,9 @@
8644
8653
  }
8645
8654
  })
8646
8655
  ),
8647
- selectionTracker.selectionAfterPointerUp$.pipe(
8656
+ selectionTracker.selectionOver$.pipe(
8648
8657
  rxjs.tap(([event, selection]) => {
8649
- selectionWithPointerUpSubject.next([
8658
+ selectionOverSubject.next([
8650
8659
  event,
8651
8660
  {
8652
8661
  document: frameDoc,
@@ -8681,7 +8690,7 @@
8681
8690
  rxjs.filter((selection) => !selection),
8682
8691
  rxjs.share()
8683
8692
  );
8684
- const selectionAfterPointerUp$ = selectionWithPointerUpSubject.asObservable();
8693
+ const selectionOver$ = selectionOverSubject.asObservable();
8685
8694
  const lastSelectionOnPointerdown$ = reader.context.containerElement$.pipe(
8686
8695
  rxjs.switchMap((container) => rxjs.fromEvent(container, "pointerdown")),
8687
8696
  rxjs.withLatestFrom(selection$),
@@ -8696,7 +8705,7 @@
8696
8705
  selection$,
8697
8706
  selectionStart$,
8698
8707
  selectionEnd$,
8699
- selectionAfterPointerUp$,
8708
+ selectionOver$,
8700
8709
  lastSelectionOnPointerdown$,
8701
8710
  getSelection: () => selectionSubject.getValue(),
8702
8711
  createOrderedRangeFromSelection