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,
|
||||
w: block.w,
|
||||
h: block.h,
|
||||
content: widgetHTML,
|
||||
content: '', // empty — we'll set innerHTML manually below
|
||||
});
|
||||
|
||||
// Add type class for color coding
|
||||
const el = document.querySelector(`[gs-id="${block.blockId}"]`);
|
||||
if (el) el.classList.add(`block-${block.type}`);
|
||||
// Gridstack uses textContent by default which escapes HTML.
|
||||
// Set innerHTML directly on the widget's content element.
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user