fix: add missing toggleUncloseaiEmbeddedModal function for floating button

- Add toggleUncloseaiEmbeddedModal function that was missing after refactoring
- Function properly toggles modal open/close state
- Export function globally for floating button onclick handler
- This fixes the floating button not appearing/working issue
This commit is contained in:
Russell Ballestrini 2025-07-03 16:41:13 -04:00
parent 76d0fb448a
commit 86718974ac

View file

@ -527,6 +527,24 @@ export function initializeSystem() {
initializeUncloseaiElements();
}
// Toggle function for floating button
export async function toggleUncloseaiEmbeddedModal() {
console.log("toggleUncloseaiEmbeddedModal called");
// Check if modal is already open
const existingModal = document.getElementById("uncloseai-embedded-modal");
if (existingModal && window.uncloseaiEmbeddedModalOpen) {
console.log("Modal is open, closing it");
existingModal.close();
document.body.removeChild(existingModal);
window.uncloseaiEmbeddedModalOpen = false;
} else {
console.log("Modal is closed, opening it");
await openUncloseaiEmbeddedModal();
}
}
// Export modal functions globally for onclick handlers
window.openTTSModal = openTTSModal;
window.openTranslateModal = openTranslateModal;
window.toggleUncloseaiEmbeddedModal = toggleUncloseaiEmbeddedModal;