1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Mobile: Fixes #13151: Reset the state of undo and redo buttons when switching editor (#13505)

This commit is contained in:
mrjo118
2025-10-29 17:22:56 +00:00
committed by GitHub
parent 7ca3aaa83f
commit 18f72c224e

View File

@@ -660,6 +660,17 @@ class NoteScreenComponent extends BaseScreenComponent<ComponentProps, State> imp
});
}
// Reset undo/redo button state when switching to edit mode or when switching between markdown and rich text editors, since the editor is
// recreated and loses its undo/redo history
if (this.state.mode === 'edit' && (prevState.mode !== this.state.mode || prevProps.editorType !== this.props.editorType)) {
this.setState({
undoRedoButtonState: {
canUndo: false,
canRedo: false,
},
});
}
if (prevProps.noteId && this.props.noteId && prevProps.noteId !== this.props.noteId) {
// Easier to just go back, then go to the note since
// the Note screen doesn't handle reloading a different note