// Load announcement content from the application info when the page loads async function loadAnnouncement() { try { const announcementText = await window.electronAPI.readApplicationInfo('announcement'); const announcementContent = document.getElementById('announcement-content'); if (announcementContent && announcementText) { console.log('Announcement:', announcementText); announcementContent.innerHTML = formatTextForHtml(announcementText); } } catch (error) { console.error('Failed to load announcement:', error); document.getElementById('announcement-content').textContent = 'Failed to load announcement.'; } } function formatTextForHtml(text) { // Replace newlines with
tags let formattedText = text.replace(/\n/g, '
'); // Replace tabs with a few non-breaking spaces for indentation formattedText = formattedText.replace(/\t/g, '    '); // Replace other special characters as needed // Example: Handle double spaces by converting to   formattedText = formattedText.replace(/ /g, '  '); return formattedText; } // Close the window when the close button is clicked function closeWindow() { window.electronAPI.writeApplicationInfo('announcement', ''); window.electronAPI.closeAnnouncementWindow(); }