adsad
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.30
|
1.1.31
|
||||||
@@ -342,6 +342,7 @@
|
|||||||
};
|
};
|
||||||
const lastContent = new Map();
|
const lastContent = new Map();
|
||||||
const syncing = new WeakSet();
|
const syncing = new WeakSet();
|
||||||
|
const syncing = new WeakSet();
|
||||||
const normalizeHtml = (value) => {
|
const normalizeHtml = (value) => {
|
||||||
return String(value || '')
|
return String(value || '')
|
||||||
.replace(/<br\s*\/?>/gi, '')
|
.replace(/<br\s*\/?>/gi, '')
|
||||||
@@ -403,9 +404,28 @@
|
|||||||
try { console.log('[PLAIN TEXT RESTORE] Inhalt wiederhergestellt.'); } catch {}
|
try { console.log('[PLAIN TEXT RESTORE] Inhalt wiederhergestellt.'); } catch {}
|
||||||
} catch {}
|
} catch {}
|
||||||
};
|
};
|
||||||
|
const syncTextFromViewOnDeselect = (model) => {
|
||||||
|
const target = resolveTextModel(model);
|
||||||
|
if (!isTextLike(target) || !target.view || !target.view.el || syncing.has(target)) return;
|
||||||
|
const viewHtml = String(target.view.el.innerHTML || '').trim();
|
||||||
|
if (!viewHtml) return;
|
||||||
|
const modelHtml = String(target.get ? target.get('content') || '' : '').trim();
|
||||||
|
if (viewHtml === modelHtml) return;
|
||||||
|
try {
|
||||||
|
syncing.add(target);
|
||||||
|
if (target.components) target.components(viewHtml);
|
||||||
|
if (target.set) target.set('content', viewHtml);
|
||||||
|
target.trigger && target.trigger('change:content');
|
||||||
|
} catch {} finally {
|
||||||
|
syncing.delete(target);
|
||||||
|
}
|
||||||
|
};
|
||||||
editor.on('component:update', (model) => restoreIfEmpty(model));
|
editor.on('component:update', (model) => restoreIfEmpty(model));
|
||||||
editor.on('component:input', (model) => restoreIfEmpty(model));
|
editor.on('component:input', (model) => restoreIfEmpty(model));
|
||||||
editor.on('component:deselected', (model) => restoreIfEmpty(model));
|
editor.on('component:deselected', (model) => {
|
||||||
|
syncTextFromViewOnDeselect(model);
|
||||||
|
restoreIfEmpty(model);
|
||||||
|
});
|
||||||
editor.on('component:add', (model) => rememberIfPresent(model));
|
editor.on('component:add', (model) => rememberIfPresent(model));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user