Skip to content

Commit fc40fc3

Browse files
OstafinLjuskora
authored andcommitted
IBX-9852: [Taggify] Added config flag to prevent adding tag by blur
1 parent 1cf0673 commit fc40fc3

File tree

1 file changed

+5
-1
lines changed
  • src/bundle/Resources/public/js/scripts/core

1 file changed

+5
-1
lines changed

src/bundle/Resources/public/js/scripts/core/taggify.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
constructor(config) {
77
this.container = config.container;
88
this.acceptKeys = config.acceptKeys ?? ['Enter'];
9+
this.shouldAddTagByInputBlur = config.shouldAddTagByInputBlur ?? true;
910
this.inputNode = config.inputNode ?? this.container.querySelector('.ibexa-taggify__input');
1011
this.listNode = config.listNode ?? this.container.querySelector('.ibexa-taggify__list');
1112
this.tagsPattern = config.tagsPattern ?? null;
@@ -159,7 +160,10 @@
159160

160161
init() {
161162
this.inputNode.addEventListener('keyup', this.handleInputKeyUp, false);
162-
this.inputNode.addEventListener('blur', this.handleInputBlur, false);
163+
164+
if (this.shouldAddTagByInputBlur) {
165+
this.inputNode.addEventListener('blur', this.handleInputBlur, false);
166+
}
163167
}
164168
}
165169

0 commit comments

Comments
 (0)