ohne blur
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.2.46
|
1.2.47
|
||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user