ohne blur repair
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.2.50
|
1.2.51
|
||||||
@@ -509,15 +509,7 @@
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1) Wenn ein ContentEditable aktiv ist, Blur auslösen, damit GrapesJS den Model-Content übernimmt
|
// 1) Selection im DOM suchen (bevorzugt)
|
||||||
if (active && (active.isContentEditable || (active.getAttribute && active.getAttribute('contenteditable') === 'true'))) {
|
|
||||||
try {
|
|
||||||
active.dispatchEvent(new Event('blur', { bubbles: true }));
|
|
||||||
syncReason = 'blur:dispatched';
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) Fallback: Selection im DOM suchen
|
|
||||||
if (!syncResult && doc && selectionEl && (selectionEl.isContentEditable || (selectionEl.getAttribute && selectionEl.getAttribute('contenteditable') === 'true'))) {
|
if (!syncResult && doc && selectionEl && (selectionEl.isContentEditable || (selectionEl.getAttribute && selectionEl.getAttribute('contenteditable') === 'true'))) {
|
||||||
const root = (selectionEl.closest && selectionEl.closest('[data-gjs-type="text"]')) || selectionEl;
|
const root = (selectionEl.closest && selectionEl.closest('[data-gjs-type="text"]')) || selectionEl;
|
||||||
const id = root && root.getAttribute ? root.getAttribute('id') : null;
|
const id = root && root.getAttribute ? root.getAttribute('id') : null;
|
||||||
@@ -525,9 +517,21 @@
|
|||||||
if (id && wrapper && wrapper.find) {
|
if (id && wrapper && wrapper.find) {
|
||||||
const found = wrapper.find(`#${id}`);
|
const found = wrapper.find(`#${id}`);
|
||||||
const comp = found && found[0];
|
const comp = found && found[0];
|
||||||
|
const type = comp && comp.get ? comp.get('type') : null;
|
||||||
|
if (!type || type === 'text' || type === 'textnode') {
|
||||||
syncFromElement(comp, root, 'selection:root');
|
syncFromElement(comp, root, 'selection:root');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// 2) Fallback: ausgewähltes Component-Element aus der View
|
||||||
|
if (!syncResult && selected) {
|
||||||
|
const selEl = (selected.getEl && selected.getEl()) || (selected.view && selected.view.el);
|
||||||
|
const type = selected.get ? selected.get('type') : null;
|
||||||
|
if (selEl && (!type || type === 'text' || type === 'textnode') &&
|
||||||
|
(selEl.isContentEditable || (selEl.getAttribute && selEl.getAttribute('contenteditable') === 'true'))) {
|
||||||
|
syncFromElement(selected, selEl, 'selected:view');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
writeDebugLog({
|
writeDebugLog({
|
||||||
event: 'save:sync:minimal',
|
event: 'save:sync:minimal',
|
||||||
|
|||||||
Reference in New Issue
Block a user