I need help implementing persistent code folding on the Monaco editor. Specifically, I am unsure about:
- how to extract the view state when it changes;
- storing it in localstorage;
- and then restoring it when Monaco is loaded.
Although I am aware of saveViewState
and restoreViewState
, I don't know how to detect when the view state changes so that I can save it using saveViewState
.
What would be the best approach for handling this situation?