ydsad
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
open: true,
|
open: true,
|
||||||
label: '🔖 Placeholder',
|
label: '🔖 Placeholder',
|
||||||
files: ['blocks-placeholder.js'],
|
files: ['blocks-placeholder.js'],
|
||||||
registration_mode: 'plugin',
|
registration_mode: 'sync',
|
||||||
},
|
},
|
||||||
// --- 2. BAUSTEINE (bausteine) ---
|
// --- 2. BAUSTEINE (bausteine) ---
|
||||||
bausteine: {
|
bausteine: {
|
||||||
|
|||||||
@@ -252,7 +252,6 @@
|
|||||||
'bridge-blocks-api',
|
'bridge-blocks-api',
|
||||||
'bridge-categorization-master',
|
'bridge-categorization-master',
|
||||||
'bridge-categorization-cleanup',
|
'bridge-categorization-cleanup',
|
||||||
'bridge-blocks-placeholder',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (LOAD_NEWSLETTER_PRESET) {
|
if (LOAD_NEWSLETTER_PRESET) {
|
||||||
@@ -304,40 +303,68 @@
|
|||||||
log('BLOCK REGISTER', 'Registriere Bridge Blöcke, um Preset-Defaults zu überschreiben.', 'purple');
|
log('BLOCK REGISTER', 'Registriere Bridge Blöcke, um Preset-Defaults zu überschreiben.', 'purple');
|
||||||
|
|
||||||
// 🛑 DYNAMISCHE AKTIVIERUNG DER SYNCHRONEN BLÖCKE (Ersetzt die fixen Aufrufe)
|
// 🛑 DYNAMISCHE AKTIVIERUNG DER SYNCHRONEN BLÖCKE (Ersetzt die fixen Aufrufe)
|
||||||
if (B.CATEGORY_CONFIG && ed) {
|
if (B.CATEGORY_CONFIG && ed) {
|
||||||
log('DYNAMIC ACTIVATION', 'Starte Aktivierung synchroner Block-Plugins (via Config).', 'purple');
|
log('DYNAMIC ACTIVATION', 'Starte Aktivierung synchroner Block-Plugins (via Config).', 'purple');
|
||||||
|
|
||||||
// Iteriere über die konfigurierten Kategorien
|
// Iteriere über die konfigurierten Kategorien
|
||||||
Object.keys(B.CATEGORY_CONFIG).forEach(catId => {
|
Object.keys(B.CATEGORY_CONFIG).forEach(catId => {
|
||||||
const config = B.CATEGORY_CONFIG[catId];
|
const config = B.CATEGORY_CONFIG[catId];
|
||||||
|
|
||||||
// Verarbeite nur SYNCHRONE Plugins, die Dateien angeben
|
// Verarbeite nur SYNCHRONE Plugins, die Dateien angeben
|
||||||
if (config.registration_mode === 'sync' && Array.isArray(config.files)) {
|
if ((config.registration_mode || 'sync') === 'sync' && Array.isArray(config.files)) {
|
||||||
|
|
||||||
config.files.forEach(fileName => {
|
config.files.forEach(fileName => {
|
||||||
|
|
||||||
// Korrigierte Funktion liefert jetzt z.B. 'BridgeBlocksCustom'
|
// Korrigierte Funktion liefert jetzt z.B. 'BridgeBlocksCustom'
|
||||||
const objectName = getPluginObjectName(fileName);
|
const objectName = getPluginObjectName(fileName);
|
||||||
const plugin = window[objectName];
|
const plugin = window[objectName];
|
||||||
|
|
||||||
// Prüfen, ob das Skript geladen wurde und die Register-Funktion vorhanden ist
|
// Prüfen, ob das Skript geladen wurde und die Register-Funktion vorhanden ist
|
||||||
if (plugin && typeof plugin.register === 'function') {
|
if (plugin && typeof plugin.register === 'function') {
|
||||||
log('DYNAMIC ACTIVATION', `Registriere sync Plugin: ${objectName} (${fileName})`, 'lime');
|
log('DYNAMIC ACTIVATION', `Registriere sync Plugin: ${objectName} (${fileName})`, 'lime');
|
||||||
try {
|
try {
|
||||||
plugin.register(ed);
|
plugin.register(ed);
|
||||||
} catch(e) {
|
if (objectName === 'BridgeBlocksPlaceholder') {
|
||||||
log('DYNAMIC ACTIVATION ERROR', `Fehler beim Registrieren von ${objectName}: ${e.message}`, 'red', 'error');
|
ed.__bridgePlaceholderActive = true;
|
||||||
}
|
}
|
||||||
|
} catch(e) {
|
||||||
|
log('DYNAMIC ACTIVATION ERROR', `Fehler beim Registrieren von ${objectName}: ${e.message}`, 'red', 'error');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log('DYNAMIC ACTIVATION WARNING', `Sync Plugin Objekt oder .register() Methode nicht gefunden: ${objectName} (${fileName})`, 'orange', 'warn');
|
log('DYNAMIC ACTIVATION WARNING', `Sync Plugin Objekt oder .register() Methode nicht gefunden: ${objectName} (${fileName})`, 'orange', 'warn');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------
|
const ensurePlaceholderBlocks = () => {
|
||||||
|
if (ed.__bridgePlaceholderActive) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (window.BridgeBlocksPlaceholder && typeof window.BridgeBlocksPlaceholder.register === 'function') {
|
||||||
|
try {
|
||||||
|
window.BridgeBlocksPlaceholder.register(ed);
|
||||||
|
ed.__bridgePlaceholderActive = true;
|
||||||
|
log('PLACEHOLDER SYNC', 'Placeholder-Plugin nachträglich aktiviert.', 'lime');
|
||||||
|
} catch (err) {
|
||||||
|
log('PLACEHOLDER ERROR', `Fehler beim Aktivieren des Placeholder-Plugins: ${err.message}`, 'red', 'error');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if (!ensurePlaceholderBlocks()) {
|
||||||
|
const fallbackSrc = B.BASE_PATH_BRIDGE + 'blocks-placeholder.js';
|
||||||
|
log('PLACEHOLDER LOAD', 'Placeholder-Plugin fehlt – lade Fallback-Skript.', '#B45309', 'warn');
|
||||||
|
loadScript(fallbackSrc, () => {
|
||||||
|
if (!ensurePlaceholderBlocks()) {
|
||||||
|
log('PLACEHOLDER ERROR', 'Placeholder-Plugin konnte auch nach Fallback nicht initialisiert werden.', 'red', 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------
|
||||||
|
|
||||||
log('INIT API', 'API-Elemente werden nun durch das Plugin bridge-blocks-api geladen. (ASYNCHRON)', 'orange');
|
log('INIT API', 'API-Elemente werden nun durch das Plugin bridge-blocks-api geladen. (ASYNCHRON)', 'orange');
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// DEBUGGING: ZÄHLE REKURSIVE EVENTS
|
// DEBUGGING: ZÄHLE REKURSIVE EVENTS
|
||||||
|
|||||||
Reference in New Issue
Block a user