adasd
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.19
|
1.1.20
|
||||||
@@ -372,37 +372,16 @@
|
|||||||
el.__bridgeLastNormalized = snap.normalized;
|
el.__bridgeLastNormalized = snap.normalized;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const syncTextFromView = (model) => {
|
|
||||||
const target = resolveTextModel(model);
|
|
||||||
if (!isTextLike(target) || !target.view || !target.view.el) return;
|
|
||||||
const html = String(target.view.el.innerHTML || '').trim();
|
|
||||||
if (!html) return;
|
|
||||||
const current = target.get ? String(target.get('content') || '').trim() : '';
|
|
||||||
if (current === html) return;
|
|
||||||
try {
|
|
||||||
syncing.add(target);
|
|
||||||
if (target.components) {
|
|
||||||
const comps = target.components();
|
|
||||||
if (comps && comps.length) comps.reset();
|
|
||||||
}
|
|
||||||
if (target.set) target.set('content', html);
|
|
||||||
target.trigger && target.trigger('change:content');
|
|
||||||
} catch {} finally {
|
|
||||||
syncing.delete(target);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const rememberIfPresent = (model) => {
|
const rememberIfPresent = (model) => {
|
||||||
const target = resolveTextModel(model);
|
const target = resolveTextModel(model);
|
||||||
if (!isTextLike(target)) return;
|
if (!isTextLike(target)) return;
|
||||||
const snap = snapshotContent(target);
|
const snap = snapshotContent(target);
|
||||||
if (!snap.normalized) return;
|
if (!snap.normalized) return;
|
||||||
if (!syncing.has(target)) syncTextFromView(target);
|
|
||||||
storeSnapshot(target, snap);
|
storeSnapshot(target, snap);
|
||||||
};
|
};
|
||||||
const restoreIfEmpty = (model) => {
|
const restoreIfEmpty = (model) => {
|
||||||
const target = resolveTextModel(model);
|
const target = resolveTextModel(model);
|
||||||
if (!isTextLike(target) || !target.get) return;
|
if (!isTextLike(target) || !target.get) return;
|
||||||
if (!syncing.has(target)) syncTextFromView(target);
|
|
||||||
const current = snapshotContent(target);
|
const current = snapshotContent(target);
|
||||||
if (current.normalized) {
|
if (current.normalized) {
|
||||||
rememberIfPresent(target);
|
rememberIfPresent(target);
|
||||||
@@ -436,18 +415,7 @@
|
|||||||
if (!editor || !editor.Canvas || !editor.Canvas.getBody) return;
|
if (!editor || !editor.Canvas || !editor.Canvas.getBody) return;
|
||||||
const logComponentInput = (model, label) => {
|
const logComponentInput = (model, label) => {
|
||||||
try {
|
try {
|
||||||
// Force-sync direct edits from view -> model before logging.
|
|
||||||
const viewEl = model && model.view && model.view.el ? model.view.el : null;
|
|
||||||
const modelType = model && model.get ? model.get('type') : undefined;
|
const modelType = model && model.get ? model.get('type') : undefined;
|
||||||
if (modelType === 'text' && model && model.get && viewEl && !model.__bridgeUiSyncing && label !== 'INPUT') {
|
|
||||||
const viewHtml = String(viewEl.innerHTML || '').trim();
|
|
||||||
const modelHtml = String(model.get('content') || '').trim();
|
|
||||||
if (viewHtml && viewHtml !== modelHtml) {
|
|
||||||
model.__bridgeUiSyncing = true;
|
|
||||||
try { model.set('content', viewHtml); } catch {}
|
|
||||||
model.__bridgeUiSyncing = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const selectedEl = model && model.view && model.view.el;
|
const selectedEl = model && model.view && model.view.el;
|
||||||
const viewOuter = selectedEl ? String(selectedEl.outerHTML || '') : '';
|
const viewOuter = selectedEl ? String(selectedEl.outerHTML || '') : '';
|
||||||
const modelContent = model && model.get ? String(model.get('content') || '') : '';
|
const modelContent = model && model.get ? String(model.get('content') || '') : '';
|
||||||
|
|||||||
Reference in New Issue
Block a user