Offline grist-electron?

I was planning to be at an event with my laptop offline and use grist-electron with a document that I had prepared and downloaded.

I opened the doc offline which uses a markdown custom widget only to find out that it was “unconfigured” and when I tried to choose the widget type, it only had URL as an option.

Just to debug this, I used my phone hotspot to get on the internet with my laptop and re-opened grist-electron and the document only to find that it worked as expected with the markdown widget.

Can someone explain why this behaviour is this way? Is there a way that I can get this to work offline?

Hello @Ed_Davison ,

I think the issue comes from the markdown custom widget which is usually served from github A cheap and cheerful Markdown viewer/editor
→ So the custom widget cannot be loaded offline.

Some background on how custom widgets have evolved in Grist.

Custom widgets began as a reference to a location on the internet to show in a widget section. That is all they were. Grist opens that location (carefully, with security in mind), gives it the user-specified level of access to the document, and then everything else that happens in that widget section is not up to Grist. So very flexible, but inherently tied to the network.

We then started to gather a collection of useful custom widgets, and eventually listed them in the product so they were easier to get at then by finding and pasting in their individual URLs. They are still references to locations on the internet though, not built in to the product. I can see how that would be confusing. We plan to update the UI soon and can try to communicate this better.

Separately, we have worked on a way to “bundle” custom widgets into a standalone package. Here is the markdown custom widget as a self contained .zip file:
https://grist-static.com/widgets/experimental/grist-widget-markdown-2024-06.zip

To use this with Grist Desktop, run it in a way that you can see its console output, and look for a line like this:

info: == userRoot: /home/paulfitz/.grist

That tells me that Grist is looking for user customizations in .grist in my home directory. Make a subdirectory called plugins within that, and unpack the .zip file into it, so that you have files like this:

/home/paulfitz/.grist/
/home/paulfitz/.grist/plugins
/home/paulfitz/.grist/plugins/grist-widget-markdown-2024-06
/home/paulfitz/.grist/plugins/grist-widget-markdown-2024-06/manifest.yml
...

One last thing, that should not be necessary but currently is because this is experimental and unfinished: set GRIST_TRUST_PLUGINS=1 in your environment when running Grist.

Now, when you run Grist, there will be a new grist-widget-markdown-2024-06 version of the Markdown widget that you can just pop in to replace what you have, and it should work entirely offline. Again, if this feature were finished, you wouldn’t need to explicitly replace your widget. Here’s a screenshot of me using it offline [hard to tell I’m offline, but normally there’d be a happy network icon in my notification bar :-)]

3 Likes

For completeness: here are the main steps for creating the .zip file with the grist-widget repository.

  • Add archive information to the markdown widget by looking at its html to see what it uses.
  • Run a bundling script (documentation in the script).

2 Likes

Thank you very much for the explanation and the zip file. I will try it soon.

I suppose that will also allow Grist Omnibus to run JPeron’s plugins, like that Signature Plugin, on our network?