How to set max-height of the editor?

Hello! So I have an editor that is wrapped inside a div that has some predetermined height. The default behavior is that the editor will grow with content but I don’t want that. How to make the editor takes up all the space inside the div? That is, set the max-height of it to the height of the div and scroll after that?

Thank you!

1 Like

A style like this might do it:

.cm-wrap { height: 100% }
.cm-scroller { overflow: auto }
1 Like

Hello, I’m using code mirror 6. Is there a code mirror 6 way to do it?

That answer was for CodeMirror 6.

This worked for me. Thanks.

In my case cm-wrap and cm-scroller are nowhere in DOM. Is this answer outdated now?

Replace cm-wrap with cm-editor for recent releases. cm-scroller is definitely still there.

2 Likes

This works fine, but how to make clicking on empty space to focus editor and show cursor ?