Fix instance-scoping bugs in AdvancedTable, Chart, Colorpicker, Dropzone, and TabsCard (#2829)

This commit is contained in:
Bartosz-Do
2026-08-07 23:51:17 +02:00
committed by GitHub
parent e1630cd918
commit 16a53474f6
6 changed files with 29 additions and 18 deletions
+9 -4
View File
@@ -31,15 +31,20 @@ const colorpickerSelector = `#colorpicker-${id}`
const swatches = swatchProps.map((prop) => window.getComputedStyle(document.body).getPropertyValue(prop))
window.Coloris &&
(window.tabler_colorpicker[colorpickerId] = Coloris({
el: colorpickerSelector,
if (window.Coloris) {
// `el` can only be configured globally, but Coloris.setInstance() scopes the rest
// (alpha, format, swatches, ...) to this selector so multiple pickers with
// different options don't clobber each other's settings.
Coloris({ el: colorpickerSelector })
Coloris.setInstance(colorpickerSelector, {
selectInput: false,
alpha,
...(format ? { format } : {}),
...(swatchesOnly ? { swatchesOnly: true } : {}),
swatches,
}))
})
window.tabler_colorpicker[colorpickerId] = colorpickerSelector
}
}
document.readyState !== 'loading' ? initColorpicker() : document.addEventListener('DOMContentLoaded', initColorpicker, { once: true })