I am looking at @codemirror/fold as inspiration for an extension I want to write.
Instead of having a
<span>...</span> element replacing the folded code, I want to have another codemirror editor instance containing the folded code.
foldWidget.toDOM() to return an editor instance works. But I cannot figure out from where to get the folded code for that line, from within the
The API used in
let line = view.visualLineAt(view.posAtDOM(event.target)) does not work outside the event handler and fails with
Uncaught RangeError: Trying to find position for a DOM position outside of the document.