fix(core): fix focus command passing through editor state instead of existing transaction

this fixes a bug introduced a few months ago that caused positions not resolving on the most recent transaction but the editor state that was existing before the last transactions beforehand existed causing the editor to crash
This commit is contained in:
Dominik Biedebach 2022-06-26 09:53:45 +02:00
parent 15123ee092
commit 5b0b7d9102

View File

@ -60,7 +60,9 @@ export const focus: RawCommands['focus'] = (position = null, options = {}) => ({
return true
}
const selection = resolveFocusPosition(editor.state.doc, position) || editor.state.selection
// pass through tr.doc instead of editor.state.doc
// since transactions could change the editors state before this command has been run
const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection
const isSameSelection = editor.state.selection.eq(selection)
if (dispatch) {