parmentelat / jupyterlab-gridwidth

BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Rowspan and colspan of a cell in a grid layout #13

Open marcel-goldschen-ohm opened 5 months ago

marcel-goldschen-ohm commented 5 months ago

Thanks for this, I was really missing the old split cell extension!

One "feature" of the old split cell extension that I really enjoyed was that I could have a markdown cell with an image taking up the majority of the vertical screen space in a half width column, and in the adjacent column I could have several code cells all half width that would all stack vertically in the column neighboring the markdown cell. Apparently split cells were added using a flow layout or similar.

As far as I can tell gridwidth only allows having a single row of adjacent cells each with some width irrespective of whether they have vastly different heights. Any chance of implementing a more grid-like style where cells can be placed into an actual rows/columns grid where both rowspan and colspan can be set for individual cells for more flexible layouts?

parmentelat commented 5 months ago

Hey

I see what you mean, and I reckon this is a drastic change from how the classic notebook "splitcell" plugin used to work

I gave this a quick look, but at first sight I cannot see an easy way to achieve this; the current implementation uses an as-simple-as-possible approach, which is to set the cells container a display: flex property, and then set each cell a width property which is a ratio like e.g. 50% however the flexbox layout algorithm does not seem to support for what you would like to get; and I am really reluctant in messing further with the properties further up the elements tree, as it is quite likely to break other aspects of the notebook layout

this being said if you can think of a better approach, I'm all ears :)

PS. on the other hand the previous method had its own drawbacks, particularly when zooming in and out was heavily used (I'm referring to slideshows for example...) so over time I got to appreciate the more stable and deterministic results we are getting now; but I admit this is not a satisfying answer for all use cases ;)

marcel-goldschen-ohm commented 5 months ago

No worries, I kind of figured this might be a big ask. Thanks again though for what you have already done, which is still a big help as is. Cheers!