Restore auto-complete in comment boxes beyond the first

This commit is contained in:
Hypolite Petovan 2020-08-08 12:58:56 -04:00
parent 5e0b4b8a8f
commit 692bb2a895
1 changed files with 9 additions and 8 deletions

View File

@ -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);
});
};
/**