This commit is contained in:
2026-02-05 00:29:42 +01:00
parent f63fae7023
commit bfe539d747
3 changed files with 27 additions and 1 deletions

View File

@@ -1 +1 @@
1.2.51 1.2.52

View File

@@ -509,7 +509,19 @@
return false; return false;
}; };
<<<<<<< ours
// 1) Selection im DOM suchen (bevorzugt) // 1) Selection im DOM suchen (bevorzugt)
=======
// 1) Bevorzugt: ausgewähltes Component-Element aus der View
if (selected) {
const selEl = (selected.getEl && selected.getEl()) || (selected.view && selected.view.el);
if (selEl && (selEl.isContentEditable || (selEl.getAttribute && selEl.getAttribute('contenteditable') === 'true'))) {
syncFromElement(selected, selEl, 'selected:view');
}
}
// 2) Fallback: Selection im DOM suchen
>>>>>>> theirs
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;

View File

@@ -772,6 +772,12 @@
if (!target) return; if (!target) return;
const isEditable = !!(target.isContentEditable || (target.getAttribute && target.getAttribute('contenteditable') === 'true')); const isEditable = !!(target.isContentEditable || (target.getAttribute && target.getAttribute('contenteditable') === 'true'));
if (!isEditable) return; if (!isEditable) return;
try {
const win = target.ownerDocument && target.ownerDocument.defaultView;
if (win) {
win.__bridgeLastEditableEl = target;
}
} catch {}
const selected = editor.getSelected && editor.getSelected(); const selected = editor.getSelected && editor.getSelected();
const selectedEl = selected && selected.view && selected.view.el; const selectedEl = selected && selected.view && selected.view.el;
let editorHtml = ''; let editorHtml = '';
@@ -792,6 +798,14 @@
const selectedEl = selected && selected.view && selected.view.el; const selectedEl = selected && selected.view && selected.view.el;
if (!selected || !selectedEl) return; if (!selected || !selectedEl) return;
if (syncing.has(selected)) return; if (syncing.has(selected)) return;
try {
const win = target.ownerDocument && target.ownerDocument.defaultView;
if (win) {
win.__bridgeLastEditableEl = target;
const id = selected.getId ? selected.getId() : (selected.get && selected.get('id'));
if (id) win.__bridgeLastEditableCompId = id;
}
} catch {}
try { try {
const viewHtml = normalizeViewHtml(selectedEl.innerHTML || ''); const viewHtml = normalizeViewHtml(selectedEl.innerHTML || '');
if (!viewHtml) return; if (!viewHtml) return;