jgraph / drawio-desktop

Official electron build of draw.io
https://www.diagrams.net
Apache License 2.0
50.75k stars 5.02k forks source link

Open local or remote diagram directly with URL #1898

Open hberge opened 2 weeks ago

hberge commented 2 weeks ago

It would be convenient to have URL links that from any program can at the same time 1. open the website/app and 2. open a diagram stored either locally or remotely. This is different to creating a link that embeds the entire diagram.

Describe the solution you'd like

Describe alternatives you've considered My current alternative is to store the link or path to the file separately. Then copy this, open the draw.io app, find the right form to open the file, then paste the URL or path and click to open it.

davidjgraph commented 2 weeks ago

Could you give a full, concrete example, including example URLs please?

hberge commented 2 weeks ago

Yes, of course. Thanks for this amazing tool by the way.

I have come to realize that I might be in the wrong repository as this is the desktop app, while I am using the online app.

In the web app the URL's to open files directly exist (decoding code starts here ).

The links start with #U for url, #L for local storage, #W for Onedrive API.

What works:

What doesn't work (for me):

Longer explanation:

#W The app does give me a link in the banner for Onedrive if I authenticate the app and open through the API. It looks something like this (note this particular link is not functional, but this would work for my use-case):

https://app.diagrams.net/#W39e456aa12b5b347%2F39E456AA93B5B348!2500#%7B%22pageId%22%3A%22wI32ebNNtJT7YJtcZUMU%22%7D

#L - I am unable to find a parallel for local files, the app does not show these as links. Therefore I can't see how such a link should be encoded, if it is possible. My attempt at encoding it looks like https://app.diagrams.net/#LC%3A%5CUsers%5Chberge%5CDocuments%5COneDrive%5Cx.drawio although I tried several variants. I also tried encoding the path with a url-encoded version of "https://app.diagrams.net/#Ufile:///C/Users/....". In both cases I get the response "File Not Found".

#U - I am unable to open an URL that I created within Onedrive and where I've set the access to an "Anyone with the link can view/edit". Using open from a URL gives the following link format:

https://app.diagrams.net/#Uhttps%3A%2F%2F1drv.ms%2Fu%2Fs!AkiztZKsVuQ5k0T71oqDCE9QivUg%3Fe%3DiRp95U
davidjgraph commented 2 weeks ago

You can't create a https protocol URL to a local file, browsers don't allow that.

hberge commented 2 weeks ago

Ah,.. I once knew, but now had forgotten that.

I now downloaded the desktop app and (on Windows) it recognizes the *.drawio extension. So I can use this to make links to the filesystem while the OS opens the app. This is enough for me at the moment, I can use this to improve my workflow.

What remains in this thread is for the webapp the inability to open URL "share links" that onedrive/sharepoint provides. (E.g. https://1drv.ms/u/s!AkiztZKq...). I also see that desktop app does not have the option to open or import from Url's or onedrive links or resources, via the File menu.

I can live without this, so having learnt two work-arounds I can use, please close the issue if you feel like it. Thanks for your time.