diff --git a/public/js/emojionearea.js b/public/js/emojionearea.js index c6d9fdb..32266a1 100644 --- a/public/js/emojionearea.js +++ b/public/js/emojionearea.js @@ -1457,23 +1457,21 @@ document = window.document || {}; id: css_class, match: /\B((:[\-+\w]*)|(@[\-+\w]*)|(#[\-+\w]*))$/, search: function (term, callback) { - if (term.startsWith(":")) { callback($.map(map, function (emoji) { return emoji.indexOf(term) === 0 ? emoji : null; })); - } else if (term.startsWith("@") && term.substring(1).length > 2){ + } else if (term.startsWith("@") && term.substring(1).length > 1){ $.ajax({ url: "https://"+$('#data_api').attr('data-instance')+"/api/v2/search?type=accounts&q="+term.substring(1), headers: {"Authorization": $('#data_api').attr('data-token')}, context: document.body }).done(function(value) { - alert(value); callback($.map(value.accounts, function (value) { return value; })); }); - }else if (term.startsWith("#") && term.substring(1).length > 2){ + }else if (term.startsWith("#") && term.substring(1).length > 1){ $.ajax({ url: "https://"+$('#data_api').attr('data-instance')+"/api/v2/search?type=hashtags&q="+term.substring(1), headers: {"Authorization": $('#data_api').attr('data-token')}, @@ -1483,6 +1481,10 @@ document = window.document || {}; return value; })); }); + } else { + callback($.map(map, function () { + return null; + })); } }, template: function (value) { @@ -1502,7 +1504,6 @@ document = window.document || {}; }else if (typeof value.name != 'undefined') { return "#"+value.name+ " "; }else{ - return shortnameTo(value, self.emojiTemplate); } },