Skip to content

Commit c4a76a4

Browse files
committed
Pass event object to beforeInsert callback
Including the event parameter allows altering the inserted text based on a modifier key (e.g. shift + click and shift + enter)
1 parent 355b9e4 commit c4a76a4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

dist/js/jquery.atwho.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ DEFAULT_CALLBACKS = {
114114
return '> ' + $1 + '<strong>' + $2 + '</strong>' + $3 + ' <';
115115
});
116116
},
117-
beforeInsert: function(value, $li) {
117+
beforeInsert: function(value, $li, e) {
118118
return value;
119119
},
120120
beforeReposition: function(offset) {
@@ -976,7 +976,7 @@ View = (function() {
976976
if (($li = this.$el.find(".cur")).length) {
977977
content = this.context.insertContentFor($li);
978978
this.context._stopDelayedCall();
979-
this.context.insert(this.context.callbacks("beforeInsert").call(this.context, content, $li), $li);
979+
this.context.insert(this.context.callbacks("beforeInsert").call(this.context, content, $li, e), $li);
980980
this.context.trigger("inserted", [$li, e]);
981981
this.hide(e);
982982
}

0 commit comments

Comments
 (0)