From 692bb2a8952722df3181cd5af8d09ce958a35986 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 8 Aug 2020 12:58:56 -0400 Subject: [PATCH] Restore auto-complete in comment boxes beyond the first --- view/js/autocomplete.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index c3993603b..0405715ac 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)); - } + $this.data('textcompleteId', textcompleteObjects.length); + textcompleteObjects.push(new Textcomplete(editor, options)); + } - textcompleteObjects[this.data('textcompleteId')].register(strategies); - - return this; + textcompleteObjects[$this.data('textcompleteId')].register(strategies); + }); }; /**