diff --git a/src/Autocomplete/assets/src/controller.ts b/src/Autocomplete/assets/src/controller.ts index 2b6eacf2d1c..151ac6ae99b 100644 --- a/src/Autocomplete/assets/src/controller.ts +++ b/src/Autocomplete/assets/src/controller.ts @@ -46,18 +46,21 @@ export default class extends Controller { #getCommonConfig(): Partial { const plugins: any = {} - // multiple values excepted if this is NOT A select (i.e. input) or a multiple select - const isMultiple = !this.selectElement || this.selectElement.multiple; - if (!this.formElement.disabled && !isMultiple) { - plugins.clear_button = { title: '' }; - } - - if (isMultiple) { - plugins.remove_button = { title: '' }; - } - - if (this.urlValue) { - plugins.virtual_scroll = {}; + // automaticly add plugins when NOT explicit configured + if (!this.tomSelectOptionsValue || !this.tomSelectOptionsValue.plugins !== undefined) { + // multiple values excepted if this is NOT A select (i.e. input) or a multiple select + const isMultiple = !this.selectElement || this.selectElement.multiple; + if (!this.formElement.disabled && !isMultiple) { + plugins.clear_button = { title: '' }; + } + + if (isMultiple) { + plugins.remove_button = { title: '' }; + } + + if (this.urlValue) { + plugins.virtual_scroll = {}; + } } const config: Partial = {