assaas
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.49
|
1.1.50
|
||||||
@@ -340,6 +340,18 @@
|
|||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
};
|
};
|
||||||
|
const resolveViewEl = (model) => {
|
||||||
|
const direct = model && model.view && model.view.el;
|
||||||
|
if (direct) return direct;
|
||||||
|
try {
|
||||||
|
const id = model && (model.getId ? model.getId() : model.get && model.get('id'));
|
||||||
|
if (!id || !editor || !editor.Canvas || !editor.Canvas.getBody) return null;
|
||||||
|
const body = editor.Canvas.getBody();
|
||||||
|
if (!body) return null;
|
||||||
|
return body.querySelector(`#${id}`);
|
||||||
|
} catch {}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
const lastContent = new Map();
|
const lastContent = new Map();
|
||||||
const syncing = new WeakSet();
|
const syncing = new WeakSet();
|
||||||
const normalizeHtml = (value) => {
|
const normalizeHtml = (value) => {
|
||||||
@@ -437,8 +449,9 @@
|
|||||||
};
|
};
|
||||||
const ensureViewMatchesModel = (model) => {
|
const ensureViewMatchesModel = (model) => {
|
||||||
const target = resolveTextModel(model);
|
const target = resolveTextModel(model);
|
||||||
if (!isTextLike(target) || !target.view || !target.view.el) return;
|
if (!isTextLike(target)) return;
|
||||||
const el = target.view.el;
|
const el = resolveViewEl(target);
|
||||||
|
if (!el) return;
|
||||||
if (el.isContentEditable || el.getAttribute('contenteditable') === 'true') return;
|
if (el.isContentEditable || el.getAttribute('contenteditable') === 'true') return;
|
||||||
const modelHtml = String(getModelHtml(target) || '').trim();
|
const modelHtml = String(getModelHtml(target) || '').trim();
|
||||||
if (!modelHtml) return;
|
if (!modelHtml) return;
|
||||||
@@ -564,7 +577,14 @@
|
|||||||
const logComponentInput = (model, label) => {
|
const logComponentInput = (model, label) => {
|
||||||
try {
|
try {
|
||||||
const modelType = model && model.get ? model.get('type') : undefined;
|
const modelType = model && model.get ? model.get('type') : undefined;
|
||||||
const selectedEl = model && model.view && model.view.el;
|
let selectedEl = model && model.view && model.view.el;
|
||||||
|
if (!selectedEl && editor && editor.Canvas && editor.Canvas.getBody) {
|
||||||
|
const body = editor.Canvas.getBody();
|
||||||
|
const id = model && (model.getId ? model.getId() : model.get && model.get('id'));
|
||||||
|
if (body && id) {
|
||||||
|
selectedEl = body.querySelector(`#${id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const viewOuter = selectedEl ? String(selectedEl.outerHTML || '') : '';
|
const viewOuter = selectedEl ? String(selectedEl.outerHTML || '') : '';
|
||||||
const modelContent = String(getModelHtmlForLog(model) || '');
|
const modelContent = String(getModelHtmlForLog(model) || '');
|
||||||
const editorHtml = editor && typeof editor.getHtml === 'function' ? String(editor.getHtml() || '') : '';
|
const editorHtml = editor && typeof editor.getHtml === 'function' ? String(editor.getHtml() || '') : '';
|
||||||
@@ -579,8 +599,13 @@
|
|||||||
editorHtml: editorHtml.slice(0, 1000),
|
editorHtml: editorHtml.slice(0, 1000),
|
||||||
});
|
});
|
||||||
if (label === 'DESELECT' && model && model.get && model.get('type') === 'text') {
|
if (label === 'DESELECT' && model && model.get && model.get('type') === 'text') {
|
||||||
const viewHtml = selectedEl ? String(selectedEl.innerHTML || '') : '';
|
let viewHtml = selectedEl ? String(selectedEl.innerHTML || '') : '';
|
||||||
const visibleText = selectedEl ? String(selectedEl.textContent || '') : '';
|
let visibleText = selectedEl ? String(selectedEl.textContent || '') : '';
|
||||||
|
if (!viewHtml && selectedEl && modelContent) {
|
||||||
|
try { selectedEl.innerHTML = modelContent; } catch {}
|
||||||
|
viewHtml = selectedEl ? String(selectedEl.innerHTML || '') : '';
|
||||||
|
visibleText = selectedEl ? String(selectedEl.textContent || '') : '';
|
||||||
|
}
|
||||||
const summary = {
|
const summary = {
|
||||||
source: 'ui',
|
source: 'ui',
|
||||||
modelId: model && (model.getId ? model.getId() : model.get && model.get('id')),
|
modelId: model && (model.getId ? model.getId() : model.get && model.get('id')),
|
||||||
|
|||||||
Reference in New Issue
Block a user