Terminology fix

This commit is contained in:
JC Brand 2019-05-26 11:20:31 +02:00
parent e1762a1bb5
commit 22e3c49660
2 changed files with 6 additions and 6 deletions

View File

@ -1102,7 +1102,7 @@ converse.plugins.add('converse-chatview', {
textarea.value = '';
textarea.value = existing+value+' ';
}
u.putCurserAtEnd(textarea);
u.placeCaretAtEnd(textarea);
},
createEmojiPicker () {

View File

@ -348,11 +348,11 @@ u.getCurrentWord = function (input, index) {
};
u.replaceCurrentWord = function (input, new_value) {
const cursor = input.selectionEnd || undefined,
current_word = _.last(input.value.slice(0, cursor).split(' ')),
const caret = input.selectionEnd || undefined,
current_word = _.last(input.value.slice(0, caret).split(' ')),
value = input.value;
input.value = value.slice(0, cursor - current_word.length) + `${new_value} ` + value.slice(cursor);
input.selectionEnd = cursor - current_word.length + new_value.length + 1;
input.value = value.slice(0, caret - current_word.length) + `${new_value} ` + value.slice(caret);
input.selectionEnd = caret - current_word.length + new_value.length + 1;
};
u.triggerEvent = function (el, name, type="Event", bubbles=true, cancelable=true) {
@ -433,7 +433,7 @@ u.getRandomInt = function (max) {
return Math.floor(Math.random() * Math.floor(max));
};
u.putCurserAtEnd = function (textarea) {
u.placeCaretAtEnd = function (textarea) {
if (textarea !== document.activeElement) {
textarea.focus();
}