editor: fix TouchEvent is not defined

This commit is contained in:
Abdullah Atta
2025-12-03 13:59:36 +05:00
parent 65ae22e70e
commit db4d998705

View File

@@ -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;
}