prompt_template/web/js/modal.js

46 lines
1,020 B
JavaScript
Raw Normal View History

/**
* Modal-Management für View und Edit Modals.
*/
/**
* Zeige View-Modal mit Titel und Inhalt
* @param {string} title - Titel des Modals
* @param {string} content - Inhalt als Text
*/
function showModal(title, content) {
document.getElementById('modal-title').textContent = title;
document.getElementById('modal-content').textContent = content;
document.getElementById('modal').classList.add('active');
}
/**
* Schließe View-Modal
*/
function closeModal() {
document.getElementById('modal').classList.remove('active');
}
/**
* Schließe Edit-Modal
*/
function closeEditModal() {
document.getElementById('edit-modal').classList.remove('active');
}
/**
* Prüfe ob View-Modal offen war (für Copy-After-View-Logic)
* @returns {boolean}
*/
function wasViewModalOpen() {
return window._wasViewModalOpen || false;
}
/**
* Merke dass View-Modal offen war
*/
function rememberViewModalOpen() {
window._wasViewModalOpen = true;
}
// exported functions are global (loaded as <script> tags)