Rework horizontal spacing code to better support embedded notebooks #2903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After 4 years, I finally found the CSS code that I wanted 💛
Before, I implemented this with media queries, to detect each of the three situations. But this does not look good when the notebook is embedded on a site with a sidebar on the left, like https://plutojl.org/en/docs/abstractplutodingetjes/
Here, I would want the notebook to be pushed to the left, to make space for widgets (like to ToC on the right). But the media queries won't work, because the window width is not the editor width. And container queries are still not implemented.
Solution! I took a long train and found this solution:
Because it uses
100%
in the calculations, it's relative to the editor (without container queries!). And all the min maxes make all the situations work.Two videos of the new behaviour, one with a simulated sidebar on the left.
Schermopname.2024-04-22.om.20.08.56.mov
Schermopname.2024-04-22.om.20.09.16.mov