Open aaronkyle opened 2 years ago
From a discussion thread about this topic:
It’s a security error:
Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
It has to do with how Mermaid constructs the canvases.
For what it's worth, https://observablehq.com/@bumbeishvili/foreignobject-exporting-issue manages to generate a PNG from a Mermaid graph. I wasn't able to spot the differences to Observable's implementation yet, since the code there is complex and heavily minified. The difference is that Observable's implementation creates the image URL via URL.createObjectURL(), while David's example constructs a utf8 data URL. Chrome supposedly limits URLs to 2MB. I'm not sure if this also applies to programmatically set URLs, but it would severely limit how this workaround can be applied.
@mythmon pointed out that the export works in Firefox.
Describe the bug Using the mermaid template literal, the options menu for a rendered visualization shows 'download PNG' as enabled (if that's the right term?). However clicking this cell does nothing.
To Reproduce Steps to reproduce the behavior:
Expected behavior Either a non-active download option or a download to PNG output.
Screenshots
Desktop (please complete the following information):