diff options
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 27011b4d4..d6893073d 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -163,25 +163,23 @@ function string2bb(element) { // Autocomplete contacts contacts = { - match: /(^|\s)(@\!*)([^ \n]{3,})$/, + 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 }; - // Autocomplete forums - forums = { - match: /(^|\s)(\!\!*)([^ \n]{2,})$/, + channels = { + match: /(^(?=[^\!]{2})|\s)(@)([^ \n]{3,})$/, index: 3, cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'f', 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 }; - // Autocomplete hashtags tags = { match: /(^|\s)(\#)([^ \n]{2,})$/, @@ -193,7 +191,6 @@ function string2bb(element) { template: tag_format }; - smilies = { match: /(^|\s)(:[a-z0-9_:]{2,})$/, index: 2, @@ -214,7 +211,8 @@ function string2bb(element) { maxCount: 100 } }); - textcomplete.register([contacts,forums,smilies,tags]); + // it seems important that contacts are before channels here. Otherwise we run into regex issues. + textcomplete.register([contacts,channels,smilies,tags]); }); }; })( jQuery ); @@ -238,16 +236,6 @@ function string2bb(element) { template: contact_format, }; - // Autocomplete forums - forums = { - match: /(^\!)([^\n]{2,})$/, - index: 2, - cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'f', [], spinelement='#nav-search-spinner'); }, - replace: basic_replace, - template: contact_format - }; - // Autocomplete hashtags tags = { match: /(^\#)([^ \n]{2,})$/, @@ -271,7 +259,7 @@ function string2bb(element) { maxCount: 100 } }); - textcomplete.register([contacts,forums,tags]); + textcomplete.register([contacts,tags]); }); textcomplete.on('selected', function() { this.editor.el.form.submit(); }); @@ -372,7 +360,7 @@ function string2bb(element) { return; if(type=='bbcode') { - var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'summary', 'map', 'nobb', 'list', 'checklist', 'question', 'answer', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'highlight', 'url', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; + var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'question', 'answer', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'mark', 'url', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr' ]; var elements = open_close_elements.concat(open_elements); |