From 1f0b20f5d407c38fdaff51ad805a03ec3d0d0d2f Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 11 May 2021 00:40:16 +0200 Subject: [PATCH] Enable context actions on input fields, partly fix of #204 --- UI/Input/TextField.ts | 2 +- index.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UI/Input/TextField.ts b/UI/Input/TextField.ts index 9b82ce31cc..b612f6b692 100644 --- a/UI/Input/TextField.ts +++ b/UI/Input/TextField.ts @@ -130,7 +130,7 @@ export class TextField extends InputElement { self.enterPressed.setData(field.value); } }); - + } public SetCursorPosition(i: number) { diff --git a/index.ts b/index.ts index 8ae565b8ce..4ae2a56884 100644 --- a/index.ts +++ b/index.ts @@ -143,6 +143,12 @@ if (layoutFromBase64.startsWith("http")) { .SetStyle("pointer-events: all;") .AttachTo("topleft-tools"); } +// Remove all context event listeners on mobile to prevent long presses window.addEventListener('contextmenu', (e) => { // Not compatible with IE < 9 + + if(e.target["nodeName"] === "INPUT"){ + return; + } e.preventDefault(); + return false; }, false);