Hello, i am very new to Prosemirror. i tryed to update the cursor position using a plugin. i tryed a bunch of different ways but it does not work the way i expect. Could you give me a hint what’s wrong?
let plugin = new Plugin({
view: (editor) => {
return {
update: (view, old) => {
if (old.doc.content.size % 5 === 0 && old.doc.content.size) {
const tr = new Transaction(view.state.doc);
const toStart = tr.setSelection(TextSelection.atStart(view.state.doc));
view.updateState(view.state.apply(toStart));
}
}
}
}
})