Skip to content

Commit

Permalink
Merge pull request Dogfalo#22 from nicknickel/v1-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRuf committed Sep 10, 2020
2 parents 13c1042 + cc696bf commit 0bad618
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions jade/page-contents/chips_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ <h3 class="header">Options</h3>
<td>{}</td>
<td>Set autocomplete options.</td>
</tr>
<tr>
<td>autocompleteOnly</td>
<td>Boolean</td>
<td>false</td>
<td>Toggles abililty to add custom value not in autocomplete list.</td>
</tr>
<tr>
<td>limit</td>
<td>Integer</td>
Expand Down
9 changes: 6 additions & 3 deletions js/chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
placeholder: '',
secondaryPlaceholder: '',
autocompleteOptions: {},
autocompleteOnly: false,
limit: Infinity,
onChipAdd: null,
onChipSelect: null,
Expand Down Expand Up @@ -267,9 +268,11 @@
}

e.preventDefault();
this.addChip({
tag: this.$input[0].value
});
if (!this.hasAutocomplete || (this.hasAutocomplete && !this.options.autocompleteOnly) ) {
this.addChip({
tag: this.$input[0].value
});
}
this.$input[0].value = '';

// delete or left
Expand Down

0 comments on commit 0bad618

Please sign in to comment.