- let notification = document.querySelector(`.${CSS_CLASSES.NOTIFICATION}`);
- if (!notification) {
- notification = document.createElement('div');
- notification.className = CSS_CLASSES.NOTIFICATION;
- document.body.appendChild(notification);
- }
- notification.innerHTML = `<i class="fa ${isError ? 'fa-times-circle' : 'fa-check'}"></i> ${message}`;
- notification.style.background = isError ? '#dc3545' : '#28a745'; // Red for error, green for success
- // Ensure it's visible before triggering transition
- notification.style.transform = 'translateX(400px)'; // Reset if previously shown
- requestAnimationFrame(() => { // Allow repaint
- notification.classList.add(CSS_CLASSES.NOTIFICATION_SHOW);
- });
-
- // Clear any existing timeout to prevent premature hiding if clicked again
- if (this.notificationTimeout) {
- clearTimeout(this.notificationTimeout);
+ if (window.$events) {
+ const eventName = isError ? 'error' : 'success';
+ window.$events.emit(eventName, message);
+ } else {
+ // Fallback for if the event system is not available
+ console.warn('BookStack event system not found, falling back to console log for notification.');
+ if (isError) {
+ console.error(message);
+ } else {
+ console.log(message);
+ }