How to make lineWrapping work in @codemirror/next?

Hi,
I’m implementing a markdown editor with @codemirror/next, the experimental one.

I am trying to add the line wrapping, so that when the div ends the user does not have to scroll to the right but the content continues in a “new” line based on the viewport.

First I tried to find where this variable was set and I found it in the heightOracle class which is in the ViewState class.

Then in the node_modules I tried to overwrite lineWrapping to true, but nothing happened.
I know this was not the right way to do it, how can I accomplish it?

Style the content element (.cm-content) to have white-space: pre-wrap.

Thank you :smiley:

(In the current git master branch there’s a ready-made extension value for that — EditorView.lineWrapping.)

1 Like