Responsive Editor Codemirror 6

Hello, I’m trying to make a responsive code editor(like in codepen), but I’m struggling.
I’ve tried:
Option 1: Make width auto. When you insert something big, the editor tries to fit the content.
Option 2: Media query. Tried, but it seems pointless because you can’t target auto-generated classes.

If anyone knows how style system of editor works, please enlighten me on how to do the desired

I think just creating a parent element that gets the right width in whichever way you want and then putting the editor inside of that should work (it’s a block element without an explicit width style, so it’ll fit the width of its parent).

1 Like

Thanks! It worked