`lineWrapping: true,` fails with TS error and does not work

Have above code. Here in text:

      const currentView = new EditorView({
        lineWrapping: true,
        parent: ref,

Get error:

Argument of type '{ lineWrapping: boolean; state: EditorState; parent: HTMLElement | undefined; dispatch: (transaction: Transaction, editorView: EditorView) => void; }' is not assignable to parameter of type 'EditorViewConfig'.
  Object literal may only specify known properties, and 'lineWrapping' does not exist in type 'EditorViewConfig'.

I try activate it here.

Not sure what I am doing wrong. I thought that’s how you can add line wrapping to CodeMirror v6.

Thanks for all the help. :heart:

As the type error tells you, lineWrapping isn’t an option that exists here. The way you enable line wrapping in CodeMirror 6 is to include EditorView.lineWrapping in your set of extensions.

1 Like

Just tried it

and it doesn’t line wrap

unless i miss something

I made sure to refresh the browser too

Make sure the editor is in an element that has a limited width. In horizontal flexboxes you sometimes have to add a wrapping element.

Did not help sadly

      <div style={{ "max-width": "100%" }}>
          class="dark:bg-neutral-900 bg-white flex flex-col gap-4 py-10 pr-10 pl-2 h-full"
          style={{ width: "100%" }}

editorRef is the CodeMirror.

Still no line wrapping.