From 00c1f49ca14d44efafa7c14d1f46c422bd088fe1 Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Thu, 30 Sep 2021 17:52:35 -0400 Subject: [PATCH] Fix slow typing speed on mobile devices --- static/application.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/static/application.js b/static/application.js index 83b4376b..e6c05c08 100644 --- a/static/application.js +++ b/static/application.js @@ -977,7 +977,7 @@ function chunkOnPaste(event) { } // This gets run every time the caret moves in the editor -function chunkOnSelectionChange(event) { +function _chunkOnSelectionChange(event, do_blur_focus) { if(!gametext_bound || !allowedit || override_focusout) { override_focusout = false; return; @@ -988,7 +988,7 @@ function chunkOnSelectionChange(event) { highlightEditingChunks(); // Attempt to prevent Chromium-based browsers on Android from // scrolling away from the current selection - if(!using_webkit_patch) { + if(do_blur_focus && !using_webkit_patch) { setTimeout(function() { game_text.blur(); game_text.focus(); @@ -998,6 +998,14 @@ function chunkOnSelectionChange(event) { }, 2); } +function chunkOnSelectionChange(event) { + return _chunkOnSelectionChange(event, true); +} + +function chunkOnKeyDownSelectionChange(event) { + return _chunkOnSelectionChange(event, false); +} + // This gets run when you defocus the editor by clicking // outside of the editor or by pressing escape or tab function chunkOnFocusOut(event) { @@ -1432,7 +1440,7 @@ $(document).ready(function(){ ).on('click', chunkOnSelectionChange ).on('keydown', - chunkOnSelectionChange + chunkOnKeyDownSelectionChange ).on('focusout', chunkOnFocusOut );