This commit is contained in:
2026-01-31 23:20:20 +01:00
parent 1b836cb4e8
commit 6e8f32e1dd
3 changed files with 27 additions and 14 deletions

View File

@@ -450,6 +450,9 @@
} catch {}
} catch {}
};
const hasInlineStyle = (html) => {
return /<span\b|style\s*=/i.test(String(html || ''));
};
const ensureViewMatchesModel = (model) => {
const target = resolveTextModel(model);
if (!isTextLike(target)) return;
@@ -462,7 +465,7 @@
if (viewHtml) return;
try {
syncing.add(target);
if (target.components) {
if (target.components && !hasInlineStyle(modelHtml)) {
try { target.components(modelHtml); } catch {}
}
if (target.set) target.set('content', modelHtml);
@@ -501,7 +504,7 @@
if (viewHtml === modelHtml) return;
try {
syncing.add(target);
if (target.components) {
if (target.components && !hasInlineStyle(viewHtml)) {
try { target.components(viewHtml); } catch {}
}
if (target.set) target.set('content', viewHtml);
@@ -536,7 +539,7 @@
if (viewHtml === modelHtml && hasComps) return;
try {
syncing.add(target);
if (target.components) {
if (target.components && !hasInlineStyle(viewHtml)) {
try { target.components(viewHtml); } catch {}
}
if (target.set) target.set('content', viewHtml);
@@ -575,6 +578,9 @@
const DEBUG_UI_SUMMARY = B && typeof B.DEBUG_UI_SUMMARY !== 'undefined'
? !!B.DEBUG_UI_SUMMARY
: true;
const hasInlineStyle = (html) => {
return /<span\b|style\s*=/i.test(String(html || ''));
};
const getModelHtmlForLog = (model) => {
if (!model) return '';
let html = '';
@@ -722,7 +728,7 @@
if (viewHtml === modelHtml) return;
try {
syncing.add(component);
if (component.components) {
if (component.components && !hasInlineStyle(viewHtml)) {
try { component.components(viewHtml); } catch {}
}
if (component.set) component.set('content', viewHtml);
@@ -790,7 +796,7 @@
const viewHtml = normalizeViewHtml(selectedEl.innerHTML || '');
if (!viewHtml) return;
syncing.add(selected);
if (selected.components) {
if (selected.components && !hasInlineStyle(viewHtml)) {
try { selected.components(viewHtml); } catch {}
}
if (selected.set) selected.set('content', viewHtml);