This commit is contained in:
2025-12-04 22:33:05 +01:00
parent 316175e158
commit 9dee06cdd6
145 changed files with 16865 additions and 88 deletions

View File

@@ -0,0 +1,79 @@
<?php
$mode = strtolower($_GET['mode'] ?? 'templates');
$ts = time();
?><!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Editor</title>
<link rel="stylesheet" href="../vendor/grapesjs/grapes.min.css" />
<style>
html,body{height:100%}body{margin:0;background:#f8fafc;color:#0f172a}#gjs{height:100vh}
.gjs-one-bg{background-color:#fff!important}.gjs-two-color{color:#0f172a!important}
.gjs-three-bg{background-color:#f8fafc!important}.gjs-four-color{color:#334155!important}
#badge{position:fixed;right:8px;top:8px;background:#eef2ff;color:#1e3a8a;border:1px solid #c7d2fe;border-radius:999px;padding:4px 10px;font:12px system-ui;z-index:2147483647;opacity:.9}
</style>
</head>
<body>
<div id="badge">lädt …</div>
<div id="gjs"></div>
<div id="blocks"></div>
<script>
function logToParent(type, detail){ try{ parent.postMessage({source:'editor-core',type:type,detail:String(detail||'')},'*'); }catch(e){} }
window.addEventListener('error', function(e){
var b=document.getElementById('badge');
if(b){ b.textContent='Fehler: '+(e&&e.message?e.message:'unbekannt'); b.style.background='#fee2e2'; b.style.color='#7f1d1d'; b.style.borderColor='#fecaca'; }
logToParent('window-error', e && e.message ? e.message : 'unknown');
});
function loadLocalScript(src, onok){
// Hinzufügen des Cache-Bust-Parameters zur URL
// Die Variable $ts wird durch PHP im HTML-Kontext eingefügt
const url = src + (src.indexOf('?') === -1 ? '?v=' : '&v=') + <?=$ts?>;
var s=document.createElement('script'); s.src=url; s.async=false;
s.onload=function(){ logToParent('script-ok', src); onok&&onok(); };
s.onerror=function(){ var b=document.getElementById('badge'); if(b){ b.textContent='Fehlt: '+src; b.style.background='#fee2e2'; b.style.color='#7f1d1d'; b.style.borderColor='#fecaca'; } logToParent('script-missing', src); };
document.head.appendChild(s);
}
logToParent('boot','start');
// 1) GrapesJS laden
loadLocalScript('../vendor/grapesjs/grapes.min.js', function(){
if(typeof window.grapesjs==='undefined'){
document.getElementById('badge').textContent='grapesjs nicht verfügbar';
logToParent('gjs-missing','window.grapesjs undefined');
return;
}
// 2.A) KRITISCHE HELPER ZUERST LADEN (Category Config)
loadLocalScript('../assets/js/bridge/category-config.js', function() {
// 2.B) Dann die zentrale Log-Funktion
// Diese muss geladen sein, bevor bridge-core.js startet!
loadLocalScript('../assets/js/bridge/general-functions.js', function() {
// 3) Plugin laden (GrapesJS Preset Newsletter)
loadLocalScript('../vendor/grapesjs-preset-newsletter/grapesjs-preset-newsletter.min.js', function(){
// 4) BRIDGE-CORE laden jetzt kann es B.LOG_CONFIG auf false setzen!
loadLocalScript('bridge-core.js', function(){
// 5) Danach config.js (Bibliothek)
// loadLocalScript('config.js');
});
// Heartbeat vom Core (sichtbar im Hauptfenster)
var hb=0, timer=setInterval(function(){ hb++; if(hb>60){clearInterval(timer);return;} logToParent('hb','tick '+hb); }, 200);
// Mode für die Bridge bereitstellen
window.__editorMode = "<?=htmlspecialchars($mode,ENT_QUOTES)?>";
});
});
});
});
</script>
</body>
</html>