diff options
author | Mario <mario@mariovavti.com> | 2021-09-04 19:46:17 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-09-04 19:46:17 +0000 |
commit | b3f2374b5789e04b3c3cea6a23070d171f393ea4 (patch) | |
tree | 728b1375b1066dc13c343469523a3888c15e49b3 /view | |
parent | 793881b9f96d1c6879790a582240944a18bd724e (diff) | |
download | volse-hubzilla-b3f2374b5789e04b3c3cea6a23070d171f393ea4.tar.gz volse-hubzilla-b3f2374b5789e04b3c3cea6a23070d171f393ea4.tar.bz2 volse-hubzilla-b3f2374b5789e04b3c3cea6a23070d171f393ea4.zip |
work around some weird regex interference
Diffstat (limited to 'view')
-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 ); |