Merge pull request #120 from marcosvega91/fix_undo_note

Fix #119
pull/128/head
Laurent Cozic 2017-12-29 19:42:48 +01:00 committed by GitHub
commit 6a75451539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class NoteTextComponent extends React.Component {
isLoading: true,
webviewReady: false,
scrollHeight: null,
editorScrollTop: 0,
editorScrollTop: 0
};
this.lastLoadedNoteId_ = null;
@ -167,6 +167,12 @@ class NoteTextComponent extends React.Component {
async componentWillReceiveProps(nextProps) {
if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) {
await this.reloadNote(nextProps);
if(this.editor_){
const session = this.editor_.editor.getSession();
const undoManager = session.getUndoManager();
undoManager.reset();
session.setUndoManager(undoManager);
}
}
if ('syncStarted' in nextProps && !nextProps.syncStarted && !this.isModified()) {
@ -334,6 +340,7 @@ class NoteTextComponent extends React.Component {
this.scheduleSave();
}
async commandAttachFile() {
const noteId = this.props.noteId;
if (!noteId) return;
@ -549,7 +556,6 @@ class NoteTextComponent extends React.Component {
delete editorRootStyle.width;
delete editorRootStyle.height;
delete editorRootStyle.fontSize;
const editor = <AceEditor
value={body}
mode="markdown"