Page 1 of 1

Saving and Exporting in Draw.io

Posted: 2018-02-25, 17:33
by Isengrim
Initially this was going to be a straight support request. After digging into it myself, I managed to find a work-around for the issue, but I still do not know why the issue manifests. Wasn't sure where to put this, so if it belongs in a better subforum feel free to move it.

I occasionally use Draw.io for diagramming, flow charts, etc. Not sure when this started, but saving or exporting drawings to a file on the local computer does not work in Pale Moon. For example, if I go to "Save As..." and then hit the "Device" button, the dialog goes away and nothing else happens. The browser's Save File dialog should appear immediately after hitting the button. This issue is present in the 27.7.2 x64 releases on both Windows 7 and LInux, without any add-ons installed or settings changed (to my knowledge).

The especially annoying part is that there are no errors logged to the web console. The webapp code is minified, but source is available on github. After some digging, I found that some of the code for saving files uses some function called "mxXmlRequest.simulate". And then I happened upon this comment:

Code: Select all

// Workaround for mxXmlRequest.simulate no longer working in Safari
// if this is used (ie PNG export broken after XML export in Safari).
Curious, I decided to experiment by changing my user agent for this site. I created a preference in about config named "general.useragent.override.draw.io" and set it to this value:

Code: Select all

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
Lo and behold, saving and exporting now works as expected.

A little more digging revealed the source code for the aforementioned simulate method within mxGraph, but that's about as far as I've gotten. If anyone else wants to try their hand at troubleshooting the issue, this might be a good starting point.

tl;dr change your user agent to something Safari-based for Draw.io, and saving or exporting should work correctly.

Re: Saving and Exporting in Draw.io

Posted: 2018-03-09, 08:52
by adesh
Sent them a pull request. Let's see if it gets accepted!
https://github.com/jgraph/drawio/pull/232

Re: Saving and Exporting in Draw.io

Posted: 2018-03-09, 11:33
by Isengrim
I suspect they'll just come back with "your browser isn't supported". That said, I'm still curious as to why that piece of code doesn't work in PM the first place.