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
This commit is contained in:
parent
cc0ae2a567
commit
97096add2a
|
@ -10647,6 +10647,14 @@ jQuery(async function () {
|
||||||
$(document).on('click', '.open_alternate_greetings', openAlternateGreetings);
|
$(document).on('click', '.open_alternate_greetings', openAlternateGreetings);
|
||||||
/* $('#set_character_world').on('click', openCharacterWorldPopup); */
|
/* $('#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) {
|
$(document).keyup(function (e) {
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
const isEditVisible = $('#curEditTextarea').is(':visible');
|
const isEditVisible = $('#curEditTextarea').is(':visible');
|
||||||
|
|
Loading…
Reference in New Issue