Make IPA Table button move cursor to end of field
This commit is contained in:
parent
769b755cd3
commit
3667ee4345
|
@ -299,6 +299,9 @@ export function setupIPATable(modal, textBox) {
|
||||||
ipaButtons = modal.querySelectorAll('.td-btn button');
|
ipaButtons = modal.querySelectorAll('.td-btn button');
|
||||||
Array.from(closeElements).forEach(close => {
|
Array.from(closeElements).forEach(close => {
|
||||||
close.addEventListener('click', () => {
|
close.addEventListener('click', () => {
|
||||||
|
textBox.focus();
|
||||||
|
const endOfTextbox = textBox.value.length;
|
||||||
|
setSelectionRange(textBox, endOfTextbox, endOfTextbox);
|
||||||
modal.parentElement.removeChild(modal);
|
modal.parentElement.removeChild(modal);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -309,7 +312,6 @@ export function setupIPATable(modal, textBox) {
|
||||||
|
|
||||||
Array.from(ipaButtons).forEach(button => {
|
Array.from(ipaButtons).forEach(button => {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
console.log(button);
|
|
||||||
insertAtCursor(headerTextBox, button.innerText);
|
insertAtCursor(headerTextBox, button.innerText);
|
||||||
textBox.value = headerTextBox.value;
|
textBox.value = headerTextBox.value;
|
||||||
});
|
});
|
||||||
|
@ -317,6 +319,8 @@ export function setupIPATable(modal, textBox) {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
headerTextBox.focus();
|
headerTextBox.focus();
|
||||||
|
const endOfTextbox = headerTextBox.value.length;
|
||||||
|
setSelectionRange(headerTextBox, endOfTextbox, endOfTextbox);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue