From c88b55d47028ecb48d6f199a2ce0fce613e0855b Mon Sep 17 00:00:00 2001 From: neo Date: Tue, 23 Jun 2026 18:14:34 +0500 Subject: [PATCH] fix: properly append drakonwidget container to DOM for diagram rendering --- index.html | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index 03dca4d..0e26a98 100644 --- a/index.html +++ b/index.html @@ -1356,30 +1356,14 @@ window.addEventListener('load', function() { // Set the diagram content widget.setDiagram('business-process', drakonDiagram, null, true); - // Position the widget in the container - // The render() method creates a container with the canvas - // We need to move it into our 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.alignItems = 'center'; - canvasContainer.style.justifyContent = 'center'; - 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); + // Append the widget's container (with canvas) to our #drakon-canvas element + if (widget.container) { + canvasContainer.appendChild(widget.container); + canvasContainer.style.display = 'flex'; + canvasContainer.style.alignItems = 'center'; + canvasContainer.style.justifyContent = 'center'; + canvasContainer.style.overflow = 'hidden'; + } }); // ============================================