asdasd
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.14
|
1.1.15
|
||||||
@@ -173,12 +173,13 @@
|
|||||||
const isText = (component.is && component.is('text'))
|
const isText = (component.is && component.is('text'))
|
||||||
|| (component.get && component.get('type') === 'text');
|
|| (component.get && component.get('type') === 'text');
|
||||||
try {
|
try {
|
||||||
if (component.set) component.set('content', content);
|
|
||||||
if (isText && component.components) {
|
if (isText && component.components) {
|
||||||
try {
|
try {
|
||||||
component.components(content);
|
const comps = component.components();
|
||||||
|
if (comps && comps.length) comps.reset();
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
if (component.set) component.set('content', content);
|
||||||
} catch {}
|
} catch {}
|
||||||
if (isText && component.view && component.view.el) {
|
if (isText && component.view && component.view.el) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -372,28 +372,37 @@
|
|||||||
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)) {
|
if (!syncing.has(target)) syncTextFromView(target);
|
||||||
const currentContent = target.get ? String(target.get('content') || '').trim() : '';
|
|
||||||
if (currentContent !== snap.html) {
|
|
||||||
try {
|
|
||||||
syncing.add(target);
|
|
||||||
if (target.set) target.set('content', snap.html);
|
|
||||||
if (target.components) target.components(snap.html);
|
|
||||||
} catch {} finally {
|
|
||||||
syncing.delete(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);
|
||||||
|
|||||||
Reference in New Issue
Block a user