Skip to content

Commit

Permalink
Pass event object to beforeInsert callback
Browse files Browse the repository at this point in the history
Including the event parameter allows altering the inserted text based
on a modifier key (e.g. shift + click and shift + enter)
  • Loading branch information
Mottie committed Feb 22, 2016
1 parent 355b9e4 commit c4a76a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/js/jquery.atwho.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ DEFAULT_CALLBACKS = {
return '> ' + $1 + '<strong>' + $2 + '</strong>' + $3 + ' <';
});
},
beforeInsert: function(value, $li) {
beforeInsert: function(value, $li, e) {
return value;
},
beforeReposition: function(offset) {
Expand Down Expand Up @@ -976,7 +976,7 @@ View = (function() {
if (($li = this.$el.find(".cur")).length) {
content = this.context.insertContentFor($li);
this.context._stopDelayedCall();
this.context.insert(this.context.callbacks("beforeInsert").call(this.context, content, $li), $li);
this.context.insert(this.context.callbacks("beforeInsert").call(this.context, content, $li, e), $li);
this.context.trigger("inserted", [$li, e]);
this.hide(e);
}
Expand Down
Loading

0 comments on commit c4a76a4

Please sign in to comment.