fix: expose modal functions to window object

This commit is contained in:
OpenClaw Bot
2026-02-17 18:36:30 +08:00
parent 6ccab612a9
commit 77d14e673f

View File

@@ -257,12 +257,16 @@
document.getElementById('modal').classList.add('show'); document.getElementById('modal').classList.add('show');
} }
window.showModal = showModal;
function hideModal() { function hideModal() {
document.getElementById('modal').classList.remove('show'); document.getElementById('modal').classList.remove('show');
document.getElementById('projectName').value = ''; document.getElementById('projectName').value = '';
document.getElementById('projectDesc').value = ''; document.getElementById('projectDesc').value = '';
} }
window.hideModal = hideModal;
async function createProject() { async function createProject() {
const name = document.getElementById('projectName').value.trim(); const name = document.getElementById('projectName').value.trim();
const desc = document.getElementById('projectDesc').value.trim(); const desc = document.getElementById('projectDesc').value.trim();
@@ -289,12 +293,15 @@
} }
} }
window.createProject = createProject;
function enterProject(projectId) { function enterProject(projectId) {
// Store selected project and redirect to workbench
localStorage.setItem('currentProject', projectId); localStorage.setItem('currentProject', projectId);
window.location.href = '/workbench.html'; window.location.href = '/workbench.html';
} }
window.enterProject = enterProject;
// Close modal on overlay click // Close modal on overlay click
document.getElementById('modal').addEventListener('click', (e) => { document.getElementById('modal').addEventListener('click', (e) => {
if (e.target.id === 'modal') hideModal(); if (e.target.id === 'modal') hideModal();