1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-17 21:15:47 +02:00

Fix wrong emoji names & issues with emoji keyboard on while using :emoji_name:

This commit is contained in:
chylex 2017-09-28 01:00:03 +02:00
parent c4d43c9d5b
commit 76b15f1971

View File

@ -84,7 +84,7 @@ enabled(){
if (refocus){ if (refocus){
this.composeInput.focus(); this.composeInput.focus();
if (lastEmojiKeyword){ if (lastEmojiKeyword && lastEmojiPosition === 0){
document.execCommand("insertText", false, lastEmojiKeyword); document.execCommand("insertText", false, lastEmojiKeyword);
} }
} }
@ -323,11 +323,13 @@ enabled(){
let foundEmoji; let foundEmoji;
for(let array of [ me.emojiData1, me.emojiData2[me.selectedSkinTone], me.emojiData3 ]){ for(let array of [ me.emojiData1, me.emojiData2[me.selectedSkinTone], me.emojiData3 ]){
if (foundIndex >= array.length){ let realArray = array.filter(ele => ele !== "___");
foundIndex -= array.length;
if (foundIndex >= realArray.length){
foundIndex -= realArray.length;
} }
else{ else{
foundEmoji = array[foundIndex]; foundEmoji = realArray[foundIndex];
break; break;
} }
} }
@ -350,8 +352,11 @@ enabled(){
ele[0].selectionEnd = ele[0].selectionStart = firstColon; ele[0].selectionEnd = ele[0].selectionStart = firstColon;
ele.trigger("change"); ele.trigger("change");
$(".emoji-keyboard-popup-btn").click(); if (!me.currentKeyboard){
$(".emoji-keyboard-search").children("input").focus(); $(".emoji-keyboard-popup-btn").click();
}
$(".emoji-keyboard-search").children("input").focus().val("");
document.execCommand("insertText", false, keywords.join(" ")); document.execCommand("insertText", false, keywords.join(" "));
} }
} }