Skip to content

Commit

Permalink
add on clear item
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Jan 16, 2023
1 parent 430c07e commit 7a29fda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @property {String} notFoundMessage Display a no suggestions found message. Leave empty to disable
* @property {Function} onRenderItem Callback function that returns the label
* @property {Function} onSelectItem Callback function to call on selection
* @property {Function} onClearItem Callback function to call on clear
* @property {Function} onServerResponse Callback function to process server response. Must return a Promise
*/

Expand Down Expand Up @@ -91,6 +92,7 @@ const DEFAULTS = {
return label;
},
onSelectItem: (item) => {},
onClearItem: (value) => {},
onServerResponse: (response) => {
return response.json();
},
Expand Down Expand Up @@ -1430,6 +1432,7 @@ class Tags {
event.stopPropagation();
if (!this.isDisabled()) {
this.removeItem(value);
this._config.onClearItem(value)
//@ts-ignore
document.activeElement.blur();
this._adjustWidth();
Expand Down
Loading

0 comments on commit 7a29fda

Please sign in to comment.