/**
 * token multiselect
 */
import IGDATAPOOLFE from '@dp/ig_datapool_fe.js';

const tomTokenMultiSelectPlugin = {
    initFields(form) {
        this.init(form);
    },
    init(form) {
	this.form = form;
	form.querySelectorAll('select.dp-tom-select.dp-tokenizer').forEach(function(el) {
	    if (el.tomselect) return;
	    new TomSelect(el, {
		plugins: ['remove_button'],
		allowEmptyOption: false
	    });
	});
    }
};
IGDATAPOOLFE.addPlugin('tomTokenMultiSelect', tomTokenMultiSelectPlugin);
export default tomTokenMultiSelectPlugin;
