Fire specific event if `allowUserOptions` was used to create a new option
Discussed in https://github.com/janosh/svelte-multiselect/discussions/262
Originally posted by igorlanko September 11, 2023 It might be useful if you want to modify the list of tags by POSTing a request to create one.
In my context, I'd need to differentiate between updating a PGSQL table with new item-tag relation link in a many-to-many table, and creating a new tag in the tags table.
What do you think?
@igorlanko Sounds good, happy to take a PR for that. You'd start by adding a new DispatchEvent key
https://github.com/janosh/svelte-multiselect/blob/c4150c953a810c0f01403438325f56278043252d/src/lib/types.ts#L19-L25
and then modifying the add function to check if it's an addition that required allowUserOptions
https://github.com/janosh/svelte-multiselect/blob/c4150c953a810c0f01403438325f56278043252d/src/lib/MultiSelect.svelte#L198-L200