forked from MarseyWorld/MarseyWorld
dont focus if i dont pick anything (and trigger the mobile keyboard unnecessarily)
parent
a88429b39a
commit
61fc2de43b
|
@ -469,6 +469,12 @@ function insertText(input, text) {
|
|||
input.selectionStart = newPos;
|
||||
|
||||
handle_disabled(input)
|
||||
|
||||
if (typeof checkForRequired === "function") checkForRequired();
|
||||
|
||||
setTimeout(() => {
|
||||
input.focus();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ function emojiAddToInput(event)
|
|||
|
||||
strToInsert = ":" + strToInsert + ":"
|
||||
insertText(emojiInputTargetDOM, strToInsert)
|
||||
insertedAnEmoji = true
|
||||
|
||||
// kick-start the preview
|
||||
emojiInputTargetDOM.dispatchEvent(new Event('input'));
|
||||
|
@ -230,17 +231,21 @@ function emojiAddToInput(event)
|
|||
}
|
||||
|
||||
const emojiModal = document.getElementById('emojiModal')
|
||||
let insertedAnEmoji
|
||||
|
||||
function openEmojiModal(t, inputTargetIDName)
|
||||
{
|
||||
selecting = false;
|
||||
insertedAnEmoji = false;
|
||||
|
||||
if (inputTargetIDName) {
|
||||
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
|
||||
emojiModal.addEventListener('hide.bs.modal', () => {
|
||||
setTimeout(() => {
|
||||
emojiInputTargetDOM.focus();
|
||||
}, 200);
|
||||
if (insertedAnEmoji) {
|
||||
setTimeout(() => {
|
||||
emojiInputTargetDOM.focus();
|
||||
}, 50);
|
||||
}
|
||||
}, {once : true});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ let commentFormID;
|
|||
function insertGIF(url) {
|
||||
const commentBox = document.getElementById(commentFormID);
|
||||
const old = commentBox.value;
|
||||
let text
|
||||
|
||||
if (old) commentBox.value = `${old}\n${url}`;
|
||||
else commentBox.value = url
|
||||
if (old) text = `${old}\n${url}`;
|
||||
else text = url
|
||||
|
||||
handle_disabled(commentBox)
|
||||
if (typeof checkForRequired === "function") checkForRequired();
|
||||
insertText(commentBox, text)
|
||||
}
|
||||
|
||||
const gifModal = document.getElementById('gifModal')
|
||||
|
@ -118,12 +118,6 @@ async function show_gif_categories(t, form) {
|
|||
bootstrap.Modal.getOrCreateInstance(document.getElementById(t.dataset.previousModal)).show()
|
||||
}, {once : true});
|
||||
}
|
||||
|
||||
gifModal.addEventListener('hide.bs.modal', () => {
|
||||
setTimeout(() => {
|
||||
document.getElementById(commentFormID).focus();
|
||||
}, 200);
|
||||
}, {once : true});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue