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

97096add2a5f9309e32b923ee08489e6b1a366d6

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +8 -0Ignore whitespace
public/script.js+8 -0
@@ -10647,6 +10647,14 @@ jQuery(async function () {
10647 $(document).on('click', '.open_alternate_greetings', openAlternateGreetings);10647 $(document).on('click', '.open_alternate_greetings', openAlternateGreetings);
10648 /* $('#set_character_world').on('click', openCharacterWorldPopup); */10648 /* $('#set_character_world').on('click', openCharacterWorldPopup); */
1064910649
10650 $(document).on('focus', 'input.auto-select, textarea.auto-select', function () {
10651 const control = $(this)[0];
10652 if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) {
10653 control.select();
10654 console.debug('Auto-selecting content of input control', control);
10655 }
10656 });
10657
10650 $(document).keyup(function (e) {10658 $(document).keyup(function (e) {
10651 if (e.key === 'Escape') {10659 if (e.key === 'Escape') {
10652 const isEditVisible = $('#curEditTextarea').is(':visible');10660 const isEditVisible = $('#curEditTextarea').is(':visible');