/* /assets/js/bridge/blocks-custom.js (FINAL & LOG-KONTROLLIERT) */ (function () { const PluginName = 'blocks-custom'; const B = window.BridgeParts || (window.BridgeParts = {}); // ---------------------------------------------------------------------- // 🎯 NEU: LOKALE LOG-KONFIGURATION UND WRAPPER // ---------------------------------------------------------------------- // Setzen Sie dies auf 'false' in der config.js oder hier, um alle Logs NUR für dieses Plugin zu deaktivieren. if (B.LOG_CONFIG && B.LOG_CONFIG.PLUGINS) { B.LOG_CONFIG.PLUGINS[PluginName] = false; // <-- HIER IST IHR SCHALTER } // NEUER LOKALER WRAPPER, der die zentrale B.log Funktion verwendet: const log = (type, message, color = '#FFD700', logType = 'info', force = false) => { if (typeof B.log === 'function') { B.log(PluginName, `[${type}] ${message}`, color, logType, force); } else if (logType === 'error') { // Fallback für kritische Fehler, wenn B.log fehlt console.error(`%c[${PluginName} - ${type}] %c${message}`, `color:red; font-weight:bold;`, 'color:inherit;'); } }; // ---------------------------------------------------------------------- log('FILE CHECK', 'Datei-IIFE startet.'); // NEU: Kontrollierbarer Start-Log if (window.__CUSTOM_BLOCKS_LOADED) return; window.__CUSTOM_BLOCKS_LOADED = true; const TARGET_CAT_ID = 'bausteine'; const ALL_CUSTOM_BLOCK_IDS = []; function addOnce(bm, id, def, category = TARGET_CAT_ID) { // Hinzufügen des Blocks und Sicherstellen der Kategorie-Zuweisung try { bm.add(id, { ...def, category }); ALL_CUSTOM_BLOCK_IDS.push(id); log('BLOCK ADD', `Block '${id}' erfolgreich hinzugefügt.`, '#B8860B'); } catch (e) { log('BLOCK ERROR', `Fehler beim Hinzufügen von Block '${id}': ${e.message}`, 'red', 'error'); } } const css = o => Object.entries(o).map(([k,v]) => `${k}:${v}`).join(';'); function register(editor) { log('EXECUTION', `Starte Block-Registrierung für ${TARGET_CAT_ID}.`, '#DAA520'); const bm = editor.BlockManager; // TEXT 2 addOnce(bm, 'cust-text', { id:'cust-text', label:'📝 Text', content:{ type:'text', content:'Dies ist ein Absatz. Doppelklick zum Bearbeiten.', style:{ 'font-family':'Arial,sans-serif', 'font-size':'14px', 'line-height':'1.5', color:'#0f172a', margin:'0 0 12px' } } }); // IMAGE addOnce(bm, 'cust-image', { id:'cust-image', label:'🖼️ Bild', content:`
|
Linke Spalte – Inhalt hier. |
Rechte Spalte – Inhalt hier. |
|
|
ÜberschriftBeschreibungstext … Mehr erfahren |
Kurzer Untertitel oder Einleitung.
Dein Unternehmen GmbH • Musterstraße 1 • 12345 Berlin