From 97096add2a5f9309e32b923ee08489e6b1a366d6 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 23 Jul 2024 21:44:48 +0200 Subject: [PATCH 1/3] Utility css class to auto-select input/textarea - Add an event listener on document level that checks for focus events on input/textarea controls. If they have the class "auto-select" the content will be auto-selected --- public/script.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/script.js b/public/script.js index dd6af9884..de922428c 100644 --- a/public/script.js +++ b/public/script.js @@ -10647,6 +10647,14 @@ jQuery(async function () { $(document).on('click', '.open_alternate_greetings', openAlternateGreetings); /* $('#set_character_world').on('click', openCharacterWorldPopup); */ + $(document).on('focus', 'input.auto-select, textarea.auto-select', function () { + const control = $(this)[0]; + if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) { + control.select(); + console.debug('Auto-selecting content of input control', control); + } + }); + $(document).keyup(function (e) { if (e.key === 'Escape') { const isEditVisible = $('#curEditTextarea').is(':visible'); From 7d2c0a8824236f6785b9c11978b860a7bc6edecc Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 23 Jul 2024 21:48:24 +0200 Subject: [PATCH 2/3] Update popup input field to use auto-select --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index e05c6e526..93a7d4750 100644 --- a/public/index.html +++ b/public/index.html @@ -4896,7 +4896,7 @@ - +