kolibril13 / jupyter-tldraw

the very good free whiteboard tldraw in the jupyter output
MIT License
252 stars 19 forks source link

Saving the state of the application #11

Open kolibril13 opened 1 year ago

kolibril13 commented 1 year ago

At the moment, closing and reopening a notebook will delete all drawings from a canvas. Also, re-executing a cell will delete all drawings from a canvas.

Current workaround: Copy the drawings to the clipboard, re-execute the cell and paste it into the fresh canvas.

Saving the state to the metadata of the notebook cell would be nice to have! E.g. buttons for

Further idea: auto-saving the state for every interaction.

For reference: there is a similar button for ipywidgets

image
TomToniq commented 11 months ago

What about the result of TldrawMakeStaticSVG and similar functions? How would I get those to stick?

kolibril13 commented 11 months ago

First version of saving and loading drawings is now possible withTldrawMakeStaticTldraw image

But that's not the final solution. Re-rendering the whole widget with interactive canvers after notebook restart is currently not possible, but that's a jupyterlab issue that might get solved at some point https://github.com/jupyterlab/jupyterlab/issues/15361

I also have the idea to convert drawings to static formats like TldrawMakeStaticSVG and TldrawMakeStaticPNG, I've made an issue for that here: https://github.com/kolibril13/jupyter-tldraw/issues/16