Dynamically change lineWrapping

I am trying to dynamically change how editor treats line wrapping. Could someone please provide a sample of dynamically enabling / disabling extension.

See this example.

Thank you for the pointer. I was able to resolve the issue.

Init editor:

let lineWrapping = true;

const lineWrappingComp = new Compartment();
const editor = new EditorView({
        state: EditorState.create({
            doc: 'test',
            extensions: [
                this.lineWrappingComp.of(lineWrapping ? EditorView.lineWrapping : [])
        parent: editorEl

When I want to change the lineWapper

lineWrapping = false;
        effects: lineWrappingComp.reconfigure(lineWrapping ? EditorView.lineWrapping : [])
1 Like