mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 22:36:14 +08:00
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:
parent
15123ee092
commit
5b0b7d9102
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user