Adding and removing CodeMirror instance on-demand, i.e. depending on … #484
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.
…the visibility of a cell - #291.
Hi all,
I took on the enhancement in #291 by only creating the CodeMirror instance if a cell is hidden (folded) and deleting the instance upon folding/hiding the cell.
I introduced a new boolean called cm_enabled that is basically !is_hidden, but allows to later add more conditions (e.g. "is cell visible on screen" - that was probably meant by viewport, right?).
The general idea is then to, instead of as before running the effect hook that set up the CodeMirror only with initial values, re-run the effect hook everytime cm_enabled changes and to wrap everything else that requires the instance into an IF that checks for cm_enabled.
This is my first contribution to this project and I hope you like it - if you have any suggestions or concerns, I'd be happy to discuss.
If this first step is done, I'd be happy to also take on the viewport-idea.