X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Fjs%2Fautocomplete.js;h=d9fcddd7b855e649ec8f298c339b8bf5624eddd6;hb=56a77f5275ba8566a37d690ade0e929c88b828e2;hp=d83f54c7c158ea6572b80c1117f5dd7ce2aa26a7;hpb=6f84b13e2a7167fd6678b1302647e62512df0f8d;p=friendica.git diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index d83f54c7c1..d9fcddd7b8 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -202,16 +202,17 @@ function string2bb(element) { // jQuery wrapper for yuku/old-textcomplete // uses a local object directory to avoid recreating Textcomplete objects $.fn.textcomplete = function (strategies, options) { - if (!(this.data('textcompleteId') in textcompleteObjects)) { - let editor = new Textcomplete.editors.Textarea(this.get(0)); + return this.each(function () { + let $this = $(this); + if (!($this.data('textcompleteId') in textcompleteObjects)) { + let editor = new Textcomplete.editors.Textarea($this.get(0)); - this.data('textcompleteId', textcompleteObjects.length); - textcompleteObjects.push(new Textcomplete(editor, options)); - } - - textcompleteObjects[this.data('textcompleteId')].register(strategies); + $this.data('textcompleteId', textcompleteObjects.length); + textcompleteObjects.push(new Textcomplete(editor, options)); + } - return this; + textcompleteObjects[$this.data('textcompleteId')].register(strategies); + }); }; /**