This commit is contained in:
2026-01-17 03:36:27 +01:00
parent 83bde470d4
commit c36209975c
2 changed files with 66 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ async function ensureAuthenticated() {
} }
function initAppFeatures() { function initAppFeatures() {
installGlobalModalGuards();
initTabs(); initTabs();
initLists(); initLists();
initCreate(); initCreate();
@@ -43,6 +44,30 @@ function initAppFeatures() {
ensureFloatingLogout({ redirect: '/login.php' }); ensureFloatingLogout({ redirect: '/login.php' });
} }
function installGlobalModalGuards() {
if (window.__modalGuardsInstalled) return;
window.__modalGuardsInstalled = true;
document.addEventListener('click', (evt) => {
const dlg = evt.target && evt.target.tagName === 'DIALOG'
? evt.target
: (evt.target && evt.target.closest ? evt.target.closest('dialog') : null);
if (!dlg) return;
if (evt.target === dlg) {
evt.preventDefault();
evt.stopPropagation();
}
}, true);
document.addEventListener('cancel', (evt) => {
const dlg = evt.target;
if (dlg && dlg.tagName === 'DIALOG') {
evt.preventDefault();
evt.stopPropagation();
}
}, true);
}
// Sync-Nachrichten aus dem Editor-Iframe (unverändert, aber mit credentials) // Sync-Nachrichten aus dem Editor-Iframe (unverändert, aber mit credentials)
async function handleEditorMessages(ev) { async function handleEditorMessages(ev) {
const msg = ev.data || {}; const msg = ev.data || {};

View File

@@ -18,14 +18,41 @@
    /**     /**
     * NEUER LOKALER WRAPPER, der die zentrale B.log Funktion verwendet.      * NEUER LOKALER WRAPPER, der die zentrale B.log Funktion verwendet.
     */      */
    const log = (type, message, color = '#1E90FF', logType = 'info', force = false) => { const log = (type, message, color = '#1E90FF', logType = 'info', force = false) => {
        // Loggt NUR, wenn B.log verfügbar ist (aus general-functions.js). // Loggt NUR, wenn B.log verfügbar ist (aus general-functions.js).
        if (typeof B.log === 'function') { if (typeof B.log === 'function') {
            B.log(PluginName, `[${type}] ${message}`, color, logType, force); B.log(PluginName, `[${type}] ${message}`, color, logType, force);
        } }
        // Ansonsten wird NICHTS geloggt, bis general-functions.js geladen ist. // Ansonsten wird NICHTS geloggt, bis general-functions.js geladen ist.
    }; };
    // ---------------------------------------------------------------------- // ----------------------------------------------------------------------
const installModalGuards = () => {
if (window.__bridgeModalGuardsInstalled) return;
window.__bridgeModalGuardsInstalled = true;
document.addEventListener('click', (evt) => {
const container = evt.target && evt.target.closest
? evt.target.closest('.gjs-mdl-container')
: null;
if (container) {
const content = evt.target.closest ? evt.target.closest('.gjs-mdl-content') : null;
if (!content) {
evt.preventDefault();
evt.stopPropagation();
}
}
}, true);
document.addEventListener('keydown', (evt) => {
if (evt.key !== 'Escape') return;
const hasModal = document.querySelector('.gjs-mdl-container');
if (hasModal) {
evt.preventDefault();
evt.stopPropagation();
}
}, true);
};
    // 🛑 GLOBALER LOG ZUR BESTÄTIGUNG DER SKRIPT-AUSFÜHRUNG     // 🛑 GLOBALER LOG ZUR BESTÄTIGUNG DER SKRIPT-AUSFÜHRUNG
    // log('START', `SKRIPT-AUSFÜHRUNG GESTARTET.`, '#DC143C', 'info', true); // DEAKTIVIERT/IGNORIERT DURCH FEHLENDEN B.log     // log('START', `SKRIPT-AUSFÜHRUNG GESTARTET.`, '#DC143C', 'info', true); // DEAKTIVIERT/IGNORIERT DURCH FEHLENDEN B.log
@@ -36,11 +63,12 @@
    const LOAD_NEWSLETTER_PRESET = false; // <<< KRITISCHER FIX: Auf FALSE gesetzt, um den "defaults" Konflikt zu beheben!     const LOAD_NEWSLETTER_PRESET = false; // <<< KRITISCHER FIX: Auf FALSE gesetzt, um den "defaults" Konflikt zu beheben!
    // ----------------------------------------------------------------------     // ----------------------------------------------------------------------
         
    if (window.__bridgeCoreInitialized) { if (window.__bridgeCoreInitialized) {
        log('INIT ABORT', 'Bridge Core wurde bereits initialisiert.', 'orange'); log('INIT ABORT', 'Bridge Core wurde bereits initialisiert.', 'orange');
        return;  return; 
    } }
    window.__bridgeCoreInitialized = true; window.__bridgeCoreInitialized = true;
installModalGuards();
         
    // --- Initialisierung BridgeParts (B) und Plugin-Registry ---     // --- Initialisierung BridgeParts (B) und Plugin-Registry ---
B.BASE_PATH_BRIDGE = '../assets/js/bridge/'; B.BASE_PATH_BRIDGE = '../assets/js/bridge/';