@blankdotpage/cake 0.1.3 → 0.1.4

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.
@@ -88,6 +88,7 @@ export declare class CakeEngine {
88
88
  private selectionDragState;
89
89
  private pointerDownPosition;
90
90
  private hasMovedSincePointerDown;
91
+ private lastTouchTime;
91
92
  constructor(options: EngineOptions);
92
93
  destroy(): void;
93
94
  setReadOnly(readOnly: boolean): void;
package/dist/index.cjs CHANGED
@@ -7662,6 +7662,7 @@ class CakeEngine {
7662
7662
  this.selectionDragState = null;
7663
7663
  this.pointerDownPosition = null;
7664
7664
  this.hasMovedSincePointerDown = false;
7665
+ this.lastTouchTime = 0;
7665
7666
  this.container = options.container;
7666
7667
  this.extensions = options.extensions ?? bundledExtensions;
7667
7668
  this.runtime = createRuntime(this.extensions);
@@ -10074,6 +10075,14 @@ class CakeEngine {
10074
10075
  if (!this.overlayRoot || !this.contentRoot) {
10075
10076
  return;
10076
10077
  }
10078
+ const isRecentTouch = Date.now() - this.lastTouchTime < 2e3;
10079
+ if (isRecentTouch) {
10080
+ this.contentRoot.classList.add("cake-touch-mode");
10081
+ this.updateCaret(null);
10082
+ this.syncSelectionRects([]);
10083
+ return;
10084
+ }
10085
+ this.contentRoot.classList.remove("cake-touch-mode");
10077
10086
  const lines = getDocLines(this.state.doc);
10078
10087
  const geometry = getSelectionGeometry({
10079
10088
  root: this.contentRoot,
@@ -10309,9 +10318,7 @@ class CakeEngine {
10309
10318
  return;
10310
10319
  }
10311
10320
  if (event.pointerType === "touch") {
10312
- this.ignoreTouchNativeSelectionUntil = performance.now() + 750;
10313
- this.suppressSelectionChangeForTick();
10314
- event.preventDefault();
10321
+ this.lastTouchTime = Date.now();
10315
10322
  return;
10316
10323
  }
10317
10324
  const selection = this.state.selection;
package/dist/index.js CHANGED
@@ -7660,6 +7660,7 @@ class CakeEngine {
7660
7660
  this.selectionDragState = null;
7661
7661
  this.pointerDownPosition = null;
7662
7662
  this.hasMovedSincePointerDown = false;
7663
+ this.lastTouchTime = 0;
7663
7664
  this.container = options.container;
7664
7665
  this.extensions = options.extensions ?? bundledExtensions;
7665
7666
  this.runtime = createRuntime(this.extensions);
@@ -10072,6 +10073,14 @@ class CakeEngine {
10072
10073
  if (!this.overlayRoot || !this.contentRoot) {
10073
10074
  return;
10074
10075
  }
10076
+ const isRecentTouch = Date.now() - this.lastTouchTime < 2e3;
10077
+ if (isRecentTouch) {
10078
+ this.contentRoot.classList.add("cake-touch-mode");
10079
+ this.updateCaret(null);
10080
+ this.syncSelectionRects([]);
10081
+ return;
10082
+ }
10083
+ this.contentRoot.classList.remove("cake-touch-mode");
10075
10084
  const lines = getDocLines(this.state.doc);
10076
10085
  const geometry = getSelectionGeometry({
10077
10086
  root: this.contentRoot,
@@ -10307,9 +10316,7 @@ class CakeEngine {
10307
10316
  return;
10308
10317
  }
10309
10318
  if (event.pointerType === "touch") {
10310
- this.ignoreTouchNativeSelectionUntil = performance.now() + 750;
10311
- this.suppressSelectionChangeForTick();
10312
- event.preventDefault();
10319
+ this.lastTouchTime = Date.now();
10313
10320
  return;
10314
10321
  }
10315
10322
  const selection = this.state.selection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blankdotpage/cake",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",