As I understand it, the general way that one uses CodeMirror is that the EditorView sizes itself according to its parent element. Suppose, however, that I want the reverse. I would like to size its parent element to the EditorView such that I can always display its entire contents without scrolling or cropping. How could I do that? Further note that in my case, I can’t directly change any CSS styling on the parent element. I need to get a width and height that I can use to set the parent element’s size via an API that it supports.
I should note that I have some code which seems to work, but I am worried that it might be depending on implementation details that are not guaranteed to remain true.