mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// Disable MaterializeCSS select initialization on Tailwind pages
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Check if we're on a Tailwind page
|
|
if (document.body.getAttribute('data-in-app') === 'true') {
|
|
// If MaterializeCSS is loaded and has a FormSelect component
|
|
if (window.M && window.M.FormSelect) {
|
|
// Store the original FormSelect init function
|
|
const originalFormSelect = window.M.FormSelect;
|
|
|
|
// Override the FormSelect init function to do nothing for Tailwind-styled selects
|
|
window.M.FormSelect = function(el, options) {
|
|
// If the select has Tailwind classes, don't initialize MaterializeCSS on it
|
|
if (el.classList.contains('form-select') ||
|
|
el.closest('.tailwind-styled-form') !== null) {
|
|
return;
|
|
}
|
|
|
|
// Otherwise, use the original initialization
|
|
return new originalFormSelect(el, options);
|
|
};
|
|
|
|
// Also prevent auto-initialization
|
|
document.querySelectorAll('select.form-select').forEach(function(select) {
|
|
select.classList.add('no-autoinit');
|
|
});
|
|
}
|
|
}
|
|
}); |