diff options
Diffstat (limited to 'assets/js/src/Dropdown.js')
-rw-r--r-- | assets/js/src/Dropdown.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/assets/js/src/Dropdown.js b/assets/js/src/Dropdown.js index 20fca8a7..81ce2509 100644 --- a/assets/js/src/Dropdown.js +++ b/assets/js/src/Dropdown.js @@ -40,6 +40,21 @@ Dropdown.prototype.listen = function() { $(this).find('a:visible')[0].click(); // Calling native click() not the jQuery one } }); + + // User mention autocomplete + $('textarea[data-mention-search-url]').textcomplete([{ + match: /(^|\s)@(\w*)$/, + search: function (term, callback) { + var url = $('textarea[data-mention-search-url]').data('mention-search-url'); + $.getJSON(url, { q: term }) + .done(function (resp) { callback(resp); }) + .fail(function () { callback([]); }); + }, + replace: function (value) { + return '$1@' + value + ' '; + }, + cache: true + }], {className: "textarea-dropdown"}); }; Dropdown.prototype.close = function() { |