fix: make tag input add remaining tag on focus lost

This commit is contained in:
Floorb 2023-05-22 14:21:25 -04:00
parent aa9d4d819c
commit e49e3d10e9
10 changed files with 42 additions and 6 deletions

View file

@ -32,6 +32,15 @@ class TagsInput {
/* Handle deletions by clicking the delete button */ /* Handle deletions by clicking the delete button */
this.containerNode.addEventListener('click', this._handleContainerClick.bind(this)); this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));
/* Handle clicks outside the input node to add the past tag */
this.inputNode.addEventListener('focusout', (evt) => {
if (this.inputNode.value) {
this.addTag(this.inputNode.value);
this.inputNode.value = "";
this.updateHiddenInputValue();
}
});
} }
detach() { detach() {

View file

@ -350,6 +350,15 @@ class TagsInput {
/* Handle deletions by clicking the delete button */ /* Handle deletions by clicking the delete button */
this.containerNode.addEventListener('click', this._handleContainerClick.bind(this)); this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));
/* Handle clicks outside the input node to add the past tag */
this.inputNode.addEventListener('focusout', (evt) => {
if (this.inputNode.value) {
this.addTag(this.inputNode.value);
this.inputNode.value = "";
this.updateHiddenInputValue();
}
});
} }
detach() { detach() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -71,6 +71,15 @@ class TagsInput {
/* Handle deletions by clicking the delete button */ /* Handle deletions by clicking the delete button */
this.containerNode.addEventListener('click', this._handleContainerClick.bind(this)); this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));
/* Handle clicks outside the input node to add the past tag */
this.inputNode.addEventListener('focusout', (evt) => {
if (this.inputNode.value) {
this.addTag(this.inputNode.value);
this.inputNode.value = "";
this.updateHiddenInputValue();
}
});
} }
detach() { detach() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -350,6 +350,15 @@ class TagsInput {
/* Handle deletions by clicking the delete button */ /* Handle deletions by clicking the delete button */
this.containerNode.addEventListener('click', this._handleContainerClick.bind(this)); this.containerNode.addEventListener('click', this._handleContainerClick.bind(this));
/* Handle clicks outside the input node to add the past tag */
this.inputNode.addEventListener('focusout', (evt) => {
if (this.inputNode.value) {
this.addTag(this.inputNode.value);
this.inputNode.value = "";
this.updateHiddenInputValue();
}
});
} }
detach() { detach() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long