I’m trying to get CodeMirror widget size following a flexbox layout, so stretching with window is resizing, but I don’t want thet the widget resizes itself when I add text inside.
If I put a fixed size on widget (i.e. 470 px) it doesn’t stretch with window resize, and when I type on editor the scrollbars appears correctly.
If I put 100% size on widget it DOES stretch with window resize but then when I type text inside itl grows without scrollbars, which I don’t want to happen.
Is there a solution for it ?
I think an additional wrapper element with 100% width around the editor will help. See https://github.com/codemirror/CodeMirror/issues/4142
I have this one :
< div class = “codeArea”>
< textarea id=codeArea>
and this one :
and this one :
But the problem is still there. I tried many combination of width on both containers, but nothing… If I get it resizing with window, it also resizes typing, with no scrollbars. When I manage to get the scrollbars it stops resizing with window.
What I’m trying to have is a single-page IDE with fixed relationship between widgets. The page should NEVER expand (I don’t want the scrollbars on it) changing editor contents, and the editor should have the size set by flex layout, and not fixed by me.
As I can see, if I put
The widget resizes itself with layout, but also grow when typing inside it; if I remove the height it will take a fixed height and NOT resize both when resizing window and when typing inside, no matter of the parent container settings.
Got it (finally!) like this :
flex:1 1 auto;
codeArea is the containing DIV. I had to set BOTH absolute positioning, corner positions AND 100% height to have it working.
It’s work for me too. thanks