From af0d40e907f44aec86fd4d0edc5d441c83afe830 Mon Sep 17 00:00:00 2001 From: phairow Date: Thu, 2 Jul 2015 14:53:35 -0700 Subject: [PATCH] Update phantomscript.js Computing the display size seems to cause the svg rendering to complete bofore saving the image. Referencing issue #181 https://github.com/knsv/mermaid/issues/181 --- lib/phantomscript.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/phantomscript.js b/lib/phantomscript.js index 11a0b42d5..2fe422589 100644 --- a/lib/phantomscript.js +++ b/lib/phantomscript.js @@ -256,6 +256,10 @@ function executeInPage(data) { svg = document.querySelector('svg') svgValue = xmlSerializer.serializeToString(svg) + // make sure the entire view area is calculated before exiting + // this solves an issue where the svg is not done rendering when the image is created + svg.getBBox(); + //console.log(document.body.outerHTML); return svgValue