Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix TouchEvent is not defined

Abdullah Attadb4d998705be
diff --git a/packages/editor/src/extensions/table/prosemirror-tables/input.ts b/packages/editor/src/extensions/table/prosemirror-tables/input.ts
index e989f76af..e1f9185f9 100644
--- a/packages/editor/src/extensions/table/prosemirror-tables/input.ts
+++ b/packages/editor/src/extensions/table/prosemirror-tables/input.ts
@@ -198,7 +198,7 @@ export function handleMouseDown(
// cell selection to be created).
setCellSelection($anchor, startEvent);
startEvent.preventDefault();
- } else if (startEvent instanceof TouchEvent) {
+ } else if (isTouchEvent(startEvent)) {
const selectedCell = view.domAtPos(view.state.selection.from).node;
if (startDOMCell?.contains(selectedCell)) {
$anchor = cellUnderMouse(view, startEvent);
@@ -313,3 +313,7 @@ function cellUnderMouse(
if (!mousePos) return null;
return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null;
}
+
+function isTouchEvent(event: Event): event is TouchEvent {
+ return "TouchEvent" in window && event instanceof TouchEvent;
+}