fix: properly append drakonwidget container to DOM for diagram rendering

This commit is contained in:
neo committed 2026-06-23 18:14:34 +05:00
1 parent ce137675c3
commit c88b55d470
1 file changed
+3 -19
+3 -19
View File
@@ -1356,30 +1356,14 @@ window.addEventListener('load', function() {
// Set the diagram content // Set the diagram content
widget.setDiagram('business-process', drakonDiagram, null, true); widget.setDiagram('business-process', drakonDiagram, null, true);
// Position the widget in the container // Append the widget's container (with canvas) to our #drakon-canvas element
// The render() method creates a container with the canvas if (widget.container) {
// We need to move it into our container canvasContainer.appendChild(widget.container);
setTimeout(function() {
// The widget creates its own container - we need to extract the canvas
var widgetContainer = widget.container || widget.canvas.parentElement;
if (widgetContainer) {
// Set explicit dimensions on our container
canvasContainer.style.display = 'flex'; canvasContainer.style.display = 'flex';
canvasContainer.style.alignItems = 'center'; canvasContainer.style.alignItems = 'center';
canvasContainer.style.justifyContent = 'center'; canvasContainer.style.justifyContent = 'center';
canvasContainer.style.overflow = 'hidden'; canvasContainer.style.overflow = 'hidden';
// Try to append the widget's content
if (widget.canvas && widget.canvas.parentElement) {
// The canvas might already be in the DOM
// Just ensure our container has the right size
var rect = canvasContainer.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) {
canvasContainer.style.height = '400px';
} }
}
}
}, 100);
}); });
// ============================================ // ============================================