Saving and Exporting in Draw.io

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
User avatar
Isengrim
Board Warrior
Board Warrior
Posts: 1325
Joined: 2015-09-08, 22:54
Location: 127.0.0.1
Contact:

Saving and Exporting in Draw.io

Unread post by Isengrim » 2018-02-25, 17:33

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.
Last edited by Isengrim on 2018-02-25, 17:38, edited 1 time in total.
a.k.a. Ascrod
Linux Mint 19.3 Cinnamon (64-bit), Debian Bullseye (64-bit), Windows 7 (64-bit)
"As long as there is someone who will appreciate the work involved in the creation, the effort is time well spent." ~ Tetsuzou Kamadani, Cave Story

User avatar
adesh
Board Warrior
Board Warrior
Posts: 1277
Joined: 2017-06-06, 07:38

Re: Saving and Exporting in Draw.io

Unread post by adesh » 2018-03-09, 08:52

Sent them a pull request. Let's see if it gets accepted!
https://github.com/jgraph/drawio/pull/232

User avatar
Isengrim
Board Warrior
Board Warrior
Posts: 1325
Joined: 2015-09-08, 22:54
Location: 127.0.0.1
Contact:

Re: Saving and Exporting in Draw.io

Unread post by Isengrim » 2018-03-09, 11:33

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.
a.k.a. Ascrod
Linux Mint 19.3 Cinnamon (64-bit), Debian Bullseye (64-bit), Windows 7 (64-bit)
"As long as there is someone who will appreciate the work involved in the creation, the effort is time well spent." ~ Tetsuzou Kamadani, Cave Story

Locked