The problem is that when the vale prop changes the cursor is moved to position 0. I can track the cursor before update with state but how to manually set the cursor of the ReactCodeMirrorRef?
I tried this but it does not seem to work:
view.state.changeByRange((range) => ({ changes: [ { from: range.from, insert: '**' }, { from: range.to, insert: '**' }, ], range: EditorSelection.range(range.from + 2, range.to + 2), })),
The problem is that when the vale prop changes the cursor is moved to position 0. I can track the cursor before update with state but how to manually set the cursor of the ReactCodeMirrorRef? I tried this but it does not seem to work:
view.state.changeByRange((range) => ({ changes: [ { from: range.from, insert: '**' }, { from: range.to, insert: '**' }, ], range: EditorSelection.range(range.from + 2, range.to + 2), })),