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;
|
input.selectionStart = newPos;
|
||||||
|
|
||||||
handle_disabled(input)
|
handle_disabled(input)
|
||||||
|
|
||||||
|
if (typeof checkForRequired === "function") checkForRequired();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
input.focus();
|
||||||
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,7 @@ function emojiAddToInput(event)
|
||||||
|
|
||||||
strToInsert = ":" + strToInsert + ":"
|
strToInsert = ":" + strToInsert + ":"
|
||||||
insertText(emojiInputTargetDOM, strToInsert)
|
insertText(emojiInputTargetDOM, strToInsert)
|
||||||
|
insertedAnEmoji = true
|
||||||
|
|
||||||
// kick-start the preview
|
// kick-start the preview
|
||||||
emojiInputTargetDOM.dispatchEvent(new Event('input'));
|
emojiInputTargetDOM.dispatchEvent(new Event('input'));
|
||||||
|
@ -230,17 +231,21 @@ function emojiAddToInput(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
const emojiModal = document.getElementById('emojiModal')
|
const emojiModal = document.getElementById('emojiModal')
|
||||||
|
let insertedAnEmoji
|
||||||
|
|
||||||
function openEmojiModal(t, inputTargetIDName)
|
function openEmojiModal(t, inputTargetIDName)
|
||||||
{
|
{
|
||||||
selecting = false;
|
selecting = false;
|
||||||
|
insertedAnEmoji = false;
|
||||||
|
|
||||||
if (inputTargetIDName) {
|
if (inputTargetIDName) {
|
||||||
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
|
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
|
||||||
emojiModal.addEventListener('hide.bs.modal', () => {
|
emojiModal.addEventListener('hide.bs.modal', () => {
|
||||||
setTimeout(() => {
|
if (insertedAnEmoji) {
|
||||||
emojiInputTargetDOM.focus();
|
setTimeout(() => {
|
||||||
}, 200);
|
emojiInputTargetDOM.focus();
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ let commentFormID;
|
||||||
function insertGIF(url) {
|
function insertGIF(url) {
|
||||||
const commentBox = document.getElementById(commentFormID);
|
const commentBox = document.getElementById(commentFormID);
|
||||||
const old = commentBox.value;
|
const old = commentBox.value;
|
||||||
|
let text
|
||||||
|
|
||||||
if (old) commentBox.value = `${old}\n${url}`;
|
if (old) text = `${old}\n${url}`;
|
||||||
else commentBox.value = url
|
else text = url
|
||||||
|
|
||||||
handle_disabled(commentBox)
|
insertText(commentBox, text)
|
||||||
if (typeof checkForRequired === "function") checkForRequired();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const gifModal = document.getElementById('gifModal')
|
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()
|
bootstrap.Modal.getOrCreateInstance(document.getElementById(t.dataset.previousModal)).show()
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
}
|
}
|
||||||
|
|
||||||
gifModal.addEventListener('hide.bs.modal', () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
document.getElementById(commentFormID).focus();
|
|
||||||
}, 200);
|
|
||||||
}, {once : true});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue