ohne blur
This commit is contained in:
@@ -518,6 +518,28 @@
|
||||
};
|
||||
|
||||
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;
|
||||
if (active) {
|
||||
syncInfo.active = {
|
||||
@@ -560,12 +582,14 @@
|
||||
} else if (selected && typeof selected.is === 'function' && (selected.is('text') || selected.is('textnode')) && view && view.el) {
|
||||
syncElement(view.el, 'selectedFallback');
|
||||
}
|
||||
const syncedAll = syncAllTextComponents();
|
||||
syncInfo.stage = 'post';
|
||||
writeDebugLog({
|
||||
event: 'save:sync',
|
||||
entityId: CURRENT_ENTITY_ID,
|
||||
sectionId: SECTION_ID || null,
|
||||
syncInfo,
|
||||
syncedAllCount: syncedAll,
|
||||
editorHtmlLen: (editor.getHtml && String(editor.getHtml() || '').length) || 0,
|
||||
editorHtmlPreview: (editor.getHtml && String(editor.getHtml() || '').slice(0, 300)) || '',
|
||||
editorCssLen: (editor.getCss && String(editor.getCss() || '').length) || 0,
|
||||
|
||||
Reference in New Issue
Block a user