This commit is contained in:
2026-02-24 02:43:40 +01:00
parent 1fc2bcbe47
commit 409fd3ac36

View File

@@ -194,7 +194,7 @@
removable: true, removable: true,
draggable: true, draggable: true,
copyable: true, copyable: true,
droppable: false, droppable: true,
'lib-id': this.get('lib-id') || '', 'lib-id': this.get('lib-id') || '',
'lib-kind': this.get('lib-kind') || '', 'lib-kind': this.get('lib-kind') || '',
rawHtml: this.get('rawHtml') || '', rawHtml: this.get('rawHtml') || '',
@@ -445,6 +445,26 @@
log(`Komponententyp '${REFERENCE_COMPONENT_TYPE}' registriert.`, '#008000'); log(`Komponententyp '${REFERENCE_COMPONENT_TYPE}' registriert.`, '#008000');
}, 0); }, 0);
}; };
const ensureReferenceDropHandling = (editor) => {
if (!editor || editor.__bridgeRefDropPatch) return;
editor.__bridgeRefDropPatch = true;
editor.on('component:add', (cmp) => {
try {
if (!cmp || typeof cmp.parent !== 'function') return;
const parent = cmp.parent();
if (!parent || typeof parent.get !== 'function') return;
if (parent.get('type') !== REFERENCE_COMPONENT_TYPE) return;
const grand = parent.parent && parent.parent();
if (!grand || typeof grand.components !== 'function') {
cmp.remove();
return;
}
const at = grand.components().indexOf(parent) + 1;
grand.append(cmp, { at });
} catch {}
});
};
// -------------------------------------------------------- // --------------------------------------------------------
// (3) HINZUGEFÜGT: Speichern-Befehl (Command) // (3) HINZUGEFÜGT: Speichern-Befehl (Command)
@@ -770,6 +790,7 @@
const plugin = (editor) => { const plugin = (editor) => {
preRegisterCategoriesAndPlaceholders(editor); preRegisterCategoriesAndPlaceholders(editor);
registerReferenceComponent(editor); registerReferenceComponent(editor);
ensureReferenceDropHandling(editor);
registerSaveCommand(editor); // HINZUGEFÜGT: Speichern-Logik registerSaveCommand(editor); // HINZUGEFÜGT: Speichern-Logik
editor.on('load', () => { editor.on('load', () => {