mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
input-pill: Add "onPillRemove" callback.
This will now allow a callback to be triggered when a pill is removed from the set.
This commit is contained in:
parent
c2a41c268f
commit
511f2f3db4
@ -135,7 +135,12 @@ var input_pill = function ($parent) {
|
||||
if (typeof idx === "number") {
|
||||
store.pills[idx].$element.remove();
|
||||
store.lastUpdated = new Date();
|
||||
return store.pills.splice(idx, 1);
|
||||
var pill = store.pills.splice(idx, 1);
|
||||
if (typeof store.removePillFunction === "function") {
|
||||
store.removePillFunction(pill);
|
||||
}
|
||||
|
||||
return pill;
|
||||
}
|
||||
},
|
||||
|
||||
@ -147,6 +152,9 @@ var input_pill = function ($parent) {
|
||||
|
||||
if (pill) {
|
||||
pill.$element.remove();
|
||||
if (typeof store.removePillFunction === "function") {
|
||||
store.removePillFunction(pill);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -319,6 +327,10 @@ var input_pill = function ($parent) {
|
||||
store.getKeyFunction = callback;
|
||||
},
|
||||
|
||||
onPillRemove: function (callback) {
|
||||
store.removePillFunction = callback;
|
||||
},
|
||||
|
||||
validate: function (callback) {
|
||||
store.validation = callback;
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user