From b3f2374b5789e04b3c3cea6a23070d171f393ea4 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 4 Sep 2021 19:46:17 +0000 Subject: work around some weird regex interference --- view/js/autocomplete.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'view/js') 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 ); -- cgit v1.2.3