diff options
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index f20c45982..596dc7076 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -162,20 +162,20 @@ function string2bb(element) { if (typeof extra_channels === 'undefined') extra_channels = false; // Autocomplete contacts - channels = { - match: /(^(?=[^\!]{2})|\s)(@)([^ \n]{3,})$/, + contacts = { + match: /(^|\s)(@\!)([^ \n]{3,})$/, index: 3, cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'c', extra_channels, spinelement=false); }, + search: function(term, callback) { contact_search(term, callback, backend_url, 'm', extra_channels, spinelement=false); }, replace: editor_replace, template: contact_format }; - contacts = { - match: /(^|\s)(@\!)([^ \n]{3,})$/, + channels = { + match: /(^(?=[^\!]{2})|\s)(@)([^ \n]{3,})$/, index: 3, cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'm', extra_channels, spinelement=false); }, + search: function(term, callback) { contact_search(term, callback, backend_url, 'c', extra_channels, spinelement=false); }, replace: editor_replace, template: contact_format }; @@ -211,7 +211,8 @@ function string2bb(element) { maxCount: 100 } }); - textcomplete.register([channels,contacts,smilies,tags]); + // it seems important that contacts are before channels here. Otherwise we run into regex issues. + textcomplete.register([contacts,channels,smilies,tags]); }); }; })( jQuery ); |