Set cursor at the end


This is a very easy question, but I took a look everywhere and couldn’t really find an easy solution.

I’m looking for a way to put cursor at the end.

It’s very useful to set cursor at the end when you’re editing content, because most of the time you want to append content, at least in my use-case.

Selection.atEnd can create a valid selection at the end of the document, which you can then pass to setSelection on a transaction.

Nice, it did the trick:

import { Selection } from 'prosemirror-state'

// set cursor at the end
const selection = Selection.atEnd(view.docView.node)
const tr =
const state = view.state.apply(tr)