Enable remove_button plugin only for multi-select fields

This commit is contained in:
Jeremy Stretch 2024-05-02 09:09:48 -04:00
parent b66cb6090c
commit e164f049fa
2 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@ -3,22 +3,22 @@ interface PluginConfig {
} }
export function getPlugins(element: HTMLSelectElement): object { export function getPlugins(element: HTMLSelectElement): object {
let plugins: PluginConfig = {} const plugins: PluginConfig = {};
// Enable "clear all" button // Enable "clear all" button
plugins.clear_button = { plugins.clear_button = {
html: (data: Dict) => html: (data: Dict) =>
`<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`, `<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`,
} };
// Enable individual "remove" buttons for items on multi-select fields // Enable individual "remove" buttons for items on multi-select fields
if (element.hasAttribute('multiple')) { if (element.hasAttribute('multiple')) {
plugins.remove_button = { plugins.remove_button = {
title: 'Remove', title: 'Remove',
} };
} }
return { return {
plugins: plugins, plugins: plugins,
} };
} }