ohne blur

This commit is contained in:
2026-02-04 03:04:22 +01:00
parent d33ef3c93d
commit 4772949c68
2 changed files with 25 additions and 1 deletions

View File

@@ -1 +1 @@
1.2.46 1.2.47

View File

@@ -518,6 +518,28 @@
}; };
const doc = editor.Canvas && editor.Canvas.getDocument ? editor.Canvas.getDocument() : null; const doc = editor.Canvas && editor.Canvas.getDocument ? editor.Canvas.getDocument() : null;
const syncAllTextComponents = () => {
if (!doc || !wrapper || !wrapper.find) return 0;
const nodes = Array.from(doc.querySelectorAll('[data-gjs-type="text"]'));
let count = 0;
nodes.forEach((el) => {
const id = el.getAttribute && el.getAttribute('id');
if (!id) return;
const found = wrapper.find(`#${id}`);
const comp = found && found[0];
if (!comp || !comp.set) return;
const html = el.innerHTML || '';
const before = typeof comp.get === 'function' ? (comp.get('content') || '') : '';
if (!html.trim() && String(before || '').trim()) return;
comp.set('content', html);
comp.trigger && comp.trigger('change:content');
if (editor && typeof editor.trigger === 'function') {
editor.trigger('component:update', comp);
}
count++;
});
return count;
};
const active = doc && doc.activeElement; const active = doc && doc.activeElement;
if (active) { if (active) {
syncInfo.active = { syncInfo.active = {
@@ -560,12 +582,14 @@
} else if (selected && typeof selected.is === 'function' && (selected.is('text') || selected.is('textnode')) && view && view.el) { } else if (selected && typeof selected.is === 'function' && (selected.is('text') || selected.is('textnode')) && view && view.el) {
syncElement(view.el, 'selectedFallback'); syncElement(view.el, 'selectedFallback');
} }
const syncedAll = syncAllTextComponents();
syncInfo.stage = 'post'; syncInfo.stage = 'post';
writeDebugLog({ writeDebugLog({
event: 'save:sync', event: 'save:sync',
entityId: CURRENT_ENTITY_ID, entityId: CURRENT_ENTITY_ID,
sectionId: SECTION_ID || null, sectionId: SECTION_ID || null,
syncInfo, syncInfo,
syncedAllCount: syncedAll,
editorHtmlLen: (editor.getHtml && String(editor.getHtml() || '').length) || 0, editorHtmlLen: (editor.getHtml && String(editor.getHtml() || '').length) || 0,
editorHtmlPreview: (editor.getHtml && String(editor.getHtml() || '').slice(0, 300)) || '', editorHtmlPreview: (editor.getHtml && String(editor.getHtml() || '').slice(0, 300)) || '',
editorCssLen: (editor.getCss && String(editor.getCss() || '').length) || 0, editorCssLen: (editor.getCss && String(editor.getCss() || '').length) || 0,