From 949b5b227e8b820927084d54b055ced51b0cfd9f Mon Sep 17 00:00:00 2001 From: Chasen Stark Date: Thu, 30 Nov 2023 13:09:40 -0500 Subject: [PATCH] Editor.ts: Update insertText comment to address keyboard 'paste' bug --- source/Editor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/Editor.ts b/source/Editor.ts index 0440229..4fe5582 100644 --- a/source/Editor.ts +++ b/source/Editor.ts @@ -259,12 +259,18 @@ class Squire { case 'insertText': // Generally we let the browser handle text insertion, as it // does so fine. However, the Samsung keyboard on Android with - // the Grammerly extension goes batshit crazy for some reason + // the Grammarly extension goes batshit crazy for some reason // and will try to disastrously rewrite the whole data, without // the user even doing anything (it can happen on first load // before the user types anything). Fortunately we can detect // this by looking for a new line in the data and if we see it, // stop it by preventing default. + // 30-11-2023 Update: The fix for Grammarly bug prevents pasting + // text directly from the keyboard on Android if the text to be + // inserted contains \n, as pasting from the keyboard does not + // fire a true paste event. The Grammarly bug seems to have been + // fixed in Samsung keyboard as of v5.6.10.4, but leaving the + // fix in place for now, as the bug is particularly destructive. if (isAndroid && event.data && event.data.includes('\n')) { event.preventDefault(); }