fix: blocks render formatted content instead of raw HTML on A4 canvas
This commit is contained in:
@@ -218,12 +218,19 @@ function addBlockToGrid(block, isNew) {
|
|||||||
y: block.y,
|
y: block.y,
|
||||||
w: block.w,
|
w: block.w,
|
||||||
h: block.h,
|
h: block.h,
|
||||||
content: widgetHTML,
|
content: '', // empty — we'll set innerHTML manually below
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add type class for color coding
|
// Gridstack uses textContent by default which escapes HTML.
|
||||||
const el = document.querySelector(`[gs-id="${block.blockId}"]`);
|
// Set innerHTML directly on the widget's content element.
|
||||||
if (el) el.classList.add(`block-${block.type}`);
|
const el = widget.el || widget;
|
||||||
|
if (el) {
|
||||||
|
const contentDiv = el.querySelector('.grid-stack-item-content');
|
||||||
|
if (contentDiv) {
|
||||||
|
contentDiv.innerHTML = widgetHTML;
|
||||||
|
}
|
||||||
|
el.classList.add(`block-${block.type}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBlockPreviewText(block) {
|
function getBlockPreviewText(block) {
|
||||||
|
|||||||
Reference in New Issue
Block a user