diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index 2fb8d0035..3e2a86ee8 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -187,21 +187,13 @@ }).on('focus', function (e) { _this.close() - }).on('blur', function (e) { - // delay, to get click on text module before widget is closed - a = $.proxy(function() { - this.close() - }, _this) - setTimeout(a, 600); }) - }; // create base template Plugin.prototype.baseTemplate = function() { this.$element.after('') this.$widget = this.$element.next() - console.log("element", this.$element); } // set height of widget @@ -246,10 +238,8 @@ Plugin.prototype.open = function() { this.active = true this.updatePosition() - b = $.proxy(function() { - this.$widget.addClass('open') - }, this) - setTimeout(b, 400); + this.$widget.addClass('open') + $(window).on('click.textmodule', $.proxy(this.close, this)) } // close widget @@ -260,6 +250,7 @@ } this.buffer = '' this.active = false + $(window).off('click.textmodule') } // check if widget is active/open