Skip to content

Commit a722608

Browse files
committed
Clear input after option selection in tomselect fields
Fixes issue #1264
1 parent 12a760d commit a722608

8 files changed

Lines changed: 11 additions & 1 deletion

assets/controllers/elements/attachment_autocomplete_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default class extends Controller {
4545
maxItems: 1,
4646
createOnBlur: true,
4747
selectOnTab: true,
48+
clearAfterSelect: true,
4849
//This a an ugly solution to disable the delimiter parsing of the TomSelect plugin
4950
delimiter: 'VERY_L0NG_D€LIMITER_WHICH_WILL_NEVER_BE_ENCOUNTERED_IN_A_STRING',
5051
dropdownParent: dropdownParent,

assets/controllers/elements/part_select_controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export default class extends Controller {
2323
valueField: "id",
2424
labelField: "name",
2525
dropdownParent: dropdownParent,
26+
selectOnTab: true,
27+
clearAfterSelect: true,
2628
preload: "focus",
2729
render: {
2830
item: (data, escape) => {

assets/controllers/elements/select_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default class extends Controller {
4949
selectOnTab: true,
5050
maxOptions: null,
5151
dropdownParent: dropdownParent,
52+
clearAfterSelect: true,
5253

5354
render: {
5455
item: this.renderItem.bind(this),

assets/controllers/elements/select_multiple_controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export default class extends Controller {
3535
maxItems: 1000,
3636
allowEmptyOption: true,
3737
dropdownParent: dropdownParent,
38+
selectOnTab: true,
39+
clearAfterSelect: true,
3840
plugins: ['remove_button'],
3941
});
4042
}

assets/controllers/elements/static_file_autocomplete_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default class extends Controller {
5656
searchField: 'text',
5757
orderField: 'text',
5858
dropdownParent: dropdownParent,
59+
clearAfterSelect: true,
5960

6061
//This a an ugly solution to disable the delimiter parsing of the TomSelect plugin
6162
delimiter: 'VERY_L0NG_D€LIMITER_WHICH_WILL_NEVER_BE_ENCOUNTERED_IN_A_STRING',

assets/controllers/elements/structural_entity_select_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default class extends Controller {
5858
delimiter: "$$VERY_LONG_DELIMITER_THAT_SHOULD_NEVER_APPEAR$$",
5959
splitOn: null,
6060
dropdownParent: dropdownParent,
61+
clearAfterSelect: true,
6162

6263
searchField: [
6364
{field: "text", weight : 2},

assets/controllers/elements/tagsinput_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default class extends Controller {
4949
createOnBlur: true,
5050
create: true,
5151
dropdownParent: dropdownParent,
52+
clearAfterSelect: true,
5253
};
5354

5455
if(this.element.dataset.autocomplete) {

assets/controllers/pages/parameters_autocomplete_controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default class extends Controller
7575
searchField: "name",
7676
//labelField: "name",
7777
valueField: "name",
78+
clearAfterSelect: true,
7879
onItemAdd: this.onItemAdd.bind(this),
7980
render: {
8081
option: (data, escape) => {
@@ -136,4 +137,4 @@ export default class extends Controller
136137
//Destroy the TomSelect instance
137138
this._tomSelect.destroy();
138139
}
139-
}
140+
}

0 commit comments

Comments
 (0)