This commit is contained in:
2026-01-27 00:52:50 +01:00
parent b16bfcc905
commit 348149722e
3 changed files with 15 additions and 2 deletions

View File

@@ -341,6 +341,7 @@
return model;
};
const lastContent = new Map();
const syncing = new WeakSet();
const normalizeHtml = (value) => {
return String(value || '')
.replace(/<br\s*\/?>/gi, '')
@@ -376,6 +377,18 @@
if (!isTextLike(target)) return;
const snap = snapshotContent(target);
if (!snap.normalized) return;
if (!syncing.has(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);
};
const restoreIfEmpty = (model) => {