commit
This commit is contained in:
76
public/editor/config.js
Normal file
76
public/editor/config.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/* /editor/config.js (SCHRITT 35: LOG-EBENEN-KONTROLLE) */
|
||||
(function() {
|
||||
|
||||
// Stelle sicher, dass BridgeParts existiert und hole die registrierten Plugins.
|
||||
const B = window.BridgeParts || {};
|
||||
|
||||
// --- 🎯 ZENTRALE LOG-KONFIGURATION (Überschreibt general-functions.js Defaults) ---
|
||||
// HINWEIS: Dies muss NACH general-functions.js geladen werden.
|
||||
B.LOG_CONFIG = B.LOG_CONFIG || {};
|
||||
|
||||
// 1. HAUPTSCHALTER: Deaktiviert alle normalen Logs (muss auf 'true' sein, damit die Ebenen-Schalter wirken)
|
||||
B.LOG_CONFIG.GLOBAL_DEBUG = true;
|
||||
|
||||
// 2. EBENEN-SCHALTER (wirken nur, wenn GLOBAL_DEBUG = true):
|
||||
B.LOG_CONFIG.INFO_ENABLED = true; // Aktiviert/Deaktiviert alle Info-Logs (B.log mit type='info')
|
||||
B.LOG_CONFIG.WARN_ENABLED = true; // Aktiviert/Deaktiviert alle Warn-Logs (B.log mit type='warn')
|
||||
B.LOG_CONFIG.ERROR_ENABLED = true; // Aktiviert/Deaktiviert alle Error-Logs (B.log mit type='error')
|
||||
|
||||
// 3. DATEN-SCHALTER: Aktiviert/Deaktiviert die Ausgabe großer Array-Daten (B.logData)
|
||||
B.LOG_CONFIG.DATA_ENABLED = true;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Sammle alle dynamisch registrierten Plugin-Namen.
|
||||
// Der Array B.GrapesJSPlugins wurde von bridge-core.js, blocks-api.js etc. gefüllt.
|
||||
const dynamicPluginNames = B.GrapesJSPlugins
|
||||
? B.GrapesJSPlugins.map(p => p.name)
|
||||
: [];
|
||||
|
||||
// Optional: Fügen Sie statische GrapesJS-Plugins hinzu
|
||||
const staticPlugins = [
|
||||
'gjs-preset-newsletter' // Beispiel: Fügt den Newsletter-Preset hinzu, falls gewünscht
|
||||
];
|
||||
|
||||
// Kombiniere alle Plugin-Namen zu einer eindeutigen Liste
|
||||
const uniquePlugins = [...new Set([
|
||||
...dynamicPluginNames,
|
||||
...staticPlugins
|
||||
])];
|
||||
|
||||
|
||||
// Definiere die Haupt-Konfiguration für GrapesJS
|
||||
const editorConfig = {
|
||||
// 1. WICHTIG: Ersetze 'gjs' durch die ID des Containers
|
||||
container: '#gjs',
|
||||
|
||||
// 2. KRITISCH: Die dynamisch erstellte Plugin-Liste
|
||||
plugins: uniquePlugins,
|
||||
|
||||
// 3. Plugin-Optionen (können leer bleiben, wenn keine Optionen benötigt werden)
|
||||
pluginsOpts: {
|
||||
// Hier Optionen für einzelne Plugins eintragen
|
||||
},
|
||||
|
||||
// --- Andere Basis-Konfigurationen ---
|
||||
panels: {
|
||||
defaults: [
|
||||
{ id: 'options', el: '.panel__options', buttons: [{ id: 'save', label: 'Speichern', className: 'fa fa-floppy-o' }] },
|
||||
{ id: 'views', el: '.panel__views' },
|
||||
]
|
||||
},
|
||||
|
||||
// ... Fügen Sie hier weitere GrapesJS-Optionen ein (z.B. device buttons)
|
||||
};
|
||||
|
||||
// Starte GrapesJS
|
||||
// window.GrapesJS.init wurde in bridge-core.js definiert, um GrapesJS zu starten.
|
||||
if (window.GrapesJS && window.GrapesJS.init) {
|
||||
// Übergebe editorConfig und die Liste der Plugin-Funktionen
|
||||
window.GrapesJS.init(editorConfig, B.GrapesJSPlugins.map(p => p.name), B.GrapesJSPlugins);
|
||||
} else {
|
||||
console.error('GrapesJS.init ist in window.GrapesJS nicht verfügbar. Wurde bridge-core.js geladen?');
|
||||
}
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user