Skip to content

Commit f5b306d

Browse files
Autocomplete: Don't add plugins automaticly when defined #379
1 parent 8e84d49 commit f5b306d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/Autocomplete/assets/src/controller.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,21 @@ export default class extends Controller {
4646
#getCommonConfig(): Partial<TomSettings> {
4747
const plugins: any = {}
4848

49-
// multiple values excepted if this is NOT A select (i.e. input) or a multiple select
50-
const isMultiple = !this.selectElement || this.selectElement.multiple;
51-
if (!this.formElement.disabled && !isMultiple) {
52-
plugins.clear_button = { title: '' };
53-
}
54-
55-
if (isMultiple) {
56-
plugins.remove_button = { title: '' };
57-
}
58-
59-
if (this.urlValue) {
60-
plugins.virtual_scroll = {};
49+
// automaticly add plugins when NOT explicit configured
50+
if (!this.tomSelectOptionsValue || !this.tomSelectOptionsValue.plugins !== undefined) {
51+
// multiple values excepted if this is NOT A select (i.e. input) or a multiple select
52+
const isMultiple = !this.selectElement || this.selectElement.multiple;
53+
if (!this.formElement.disabled && !isMultiple) {
54+
plugins.clear_button = { title: '' };
55+
}
56+
57+
if (isMultiple) {
58+
plugins.remove_button = { title: '' };
59+
}
60+
61+
if (this.urlValue) {
62+
plugins.virtual_scroll = {};
63+
}
6164
}
6265

6366
const config: Partial<TomSettings> = {

0 commit comments

Comments
 (0)