From a898177a20a02b2341e09fee5754f54eb7b0bc57 Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Fri, 15 Jan 2016 13:16:28 +0100 Subject: [PATCH] Fixed events config. Closes #215 --- js/bootstrap-markdown.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/bootstrap-markdown.js b/js/bootstrap-markdown.js index 3598e83..9f8d00e 100644 --- a/js/bootstrap-markdown.js +++ b/js/bootstrap-markdown.js @@ -161,17 +161,21 @@ this.$textarea.css('resize',this.$options.resize); } - this.$textarea - .on('focus', $.proxy(this.focus, this)) - .on('keypress', $.proxy(this.keypress, this)) - .on('keyup', $.proxy(this.keyup, this)) - .on('change', $.proxy(this.change, this)) - .on('select', $.proxy(this.select, this)); + this.$textarea.on({ + 'focus' : $.proxy(this.focus, this), + 'keyup' : $.proxy(this.keyup, this), + 'change' : $.proxy(this.change, this), + 'select' : $.proxy(this.select, this) + }); if (this.eventSupported('keydown')) { this.$textarea.on('keydown', $.proxy(this.keydown, this)); } + if (this.eventSupported('keypress')) { + this.$textarea.on('keypress', $.proxy(this.keypress, this)) + } + // Re-attach markdown data this.$textarea.data('markdown',this); }