commit
This commit is contained in:
64
public/editor/editor-core (Kopie).php
Normal file
64
public/editor/editor-core (Kopie).php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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){
|
||||
var s=document.createElement('script'); s.src=src; 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?v=<?=$ts?>', function(){
|
||||
if(typeof window.grapesjs==='undefined'){ document.getElementById('badge').textContent='grapesjs nicht verfügbar'; logToParent('gjs-missing','window.grapesjs undefined'); return; }
|
||||
|
||||
// 2) Plugin laden
|
||||
loadLocalScript('../vendor/grapesjs-preset-newsletter/grapesjs-preset-newsletter.min.js?v=<?=$ts?>', function(){
|
||||
|
||||
// 3) BRIDGE ZUERST (mit Cache-Bust) – meldet sich sofort mit bridge:boot
|
||||
loadLocalScript('bridge-core.js?v=<?=$ts?>', function(){
|
||||
// 4) Danach config.js (Bibliothek)
|
||||
// loadLocalScript('config.js?v=<?=$ts?>');
|
||||
});
|
||||
|
||||
// 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>
|
||||
|
||||
Reference in New Issue
Block a user