deathbeds / ipydrawio

A standalone embedding of the FOSS drawio / mxgraph package into jupyterlab
https://ipydrawio.rtfd.io
Apache License 2.0
51 stars 4 forks source link

render widget with Panel library #86

Open nlooije opened 2 years ago

nlooije commented 2 years ago

Sorry for the many bug reports and feature requests lately. I really appreciate the work you put into ipydrawio and any feedback and support you give.

Motivation

I would like for the ipydrawio widget to be able to render within a Panel app.

Panel is an open-source Python library that lets you create custom interactive web apps and dashboards by connecting user-defined widgets to plots, images, tables, or text.

This library is useful when integrating the ipydrawio widget into a GUI

Panel library can be used to develop rich interactive applications without tying your domain-specific code to any particular GUI or web tools.

Design Ideas

Currently, it doesn't seem that the ipydrawio widget renders within the Panel library.

image

No errors are generated, nothing to help make it render or where to start:

image

Rather than issuing a bug report i figured that rendering within Panel wasn't a design goal so it would be best to add this as a feature request.

Honestly, i don't have the faintest idea why it is not rendering with panel. Other widgets are rendering something:

ipyleaflet: image

ipyvolume: image

bollwyvl commented 2 years ago

without tying your domain-specific code to any particular GUI or web tools.

... except panel

Yeah, panel integration is kind of a moving target, non-goal, and a dependency unacceptable, but if you contributed a tutorial as a PR with tests, I'd take it. You'll probably want to dig a bit deeper into the DOM itself to see if it's actually showing up... for... reasons... under the hood Diagram is actually a Box and might just need a bit more layout configuration to appease whatever panel wraps it in. It may be easier to experiment with another box around it, and if panel can't handle Boxes, then that's pretty much endgame.

nlooije commented 2 years ago

Ok, Panel seems to handle boxes just fine:

image

and wrapping Diagram in a box also gives no issues:

image

but combining yields nothing:

image

I am still looking at what the main differences in HTML generated are