From baa46e105c99e057f4678f837a8ce20d3b8a580f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Apr 2018 20:08:03 +0200 Subject: if there is more than one textarea we need to work through all of them --- view/js/autocomplete.js | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'view/js') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 5fbdab27b..60552588e 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -231,10 +231,13 @@ function string2bb(element) { this.attr('autocomplete','off'); var Textarea = Textcomplete.editors.Textarea; - var editor = new Textarea(this[0]); - var textcomplete = new Textcomplete(editor); - textcomplete.register([contacts,forums,smilies,tags], {className:'acpopup', zIndex:1020}); + $(this).each(function() { + var editor = new Textarea(this); + var textcomplete = new Textcomplete(editor); + textcomplete.register([contacts,forums,smilies,tags], {className:'acpopup', zIndex:1020}); + }); + }; })( jQuery ); @@ -282,10 +285,11 @@ function string2bb(element) { this.attr('autocomplete', 'off'); var Textarea = Textcomplete.editors.Textarea; - var editor = new Textarea(this[0]); - var textcomplete = new Textcomplete(editor); - - textcomplete.register([contacts,forums,tags], {className:'acpopup', maxCount:100, zIndex: 1020, appendTo:'nav'}); + $(this).each(function() { + var editor = new Textarea(this); + var textcomplete = new Textcomplete(editor); + textcomplete.register([contacts,forums,tags], {className:'acpopup', maxCount:100, zIndex: 1020, appendTo:'nav'}); + }); this.on('select', function(e, value, strategy) { submit_form(this); }); }; @@ -313,10 +317,11 @@ function string2bb(element) { this.attr('autocomplete','off'); var Textarea = Textcomplete.editors.Textarea; - var editor = new Textarea(this[0]); - var textcomplete = new Textcomplete(editor); - - textcomplete.register([contacts], {className:'acpopup', zIndex:1020}); + $(this).each(function() { + var editor = new Textarea(this); + var textcomplete = new Textcomplete(editor); + textcomplete.register([contacts], {className:'acpopup', zIndex:1020}); + }); if(autosubmit) this.on('select', function(e,value,strategy) { submit_form(this); }); @@ -349,10 +354,12 @@ function string2bb(element) { this.attr('autocomplete','off'); var Textarea = Textcomplete.editors.Textarea; - var editor = new Textarea(this[0]); - var textcomplete = new Textcomplete(editor); - textcomplete.register([names], {className:'acpopup', zIndex:1020}); + $(this).each(function() { + var editor = new Textarea(this); + var textcomplete = new Textcomplete(editor); + textcomplete.register([names], {className:'acpopup', zIndex:1020}); + }); if(autosubmit) this.on('select', function(e,value,strategy) { submit_form(this); }); @@ -427,10 +434,12 @@ function string2bb(element) { this.attr('autocomplete','off'); var Textarea = Textcomplete.editors.Textarea; - var editor = new Textarea(this[0]); - var textcomplete = new Textcomplete(editor); - textcomplete.register([bbco], {className:'acpopup', zIndex:1020}); + $(this).each(function() { + var editor = new Textarea(this); + var textcomplete = new Textcomplete(editor); + textcomplete.register([bbco], {className:'acpopup', zIndex:1020}); + }); this.on('select', function(e, value, strategy) { value; }); -- cgit v1.2.3