From 38c050b47e4aee30c7afe084b07aad31702e68ef Mon Sep 17 00:00:00 2001 From: marcosvega91 Date: Fri, 22 Dec 2017 15:43:01 +0100 Subject: [PATCH] Removed duplicate editor variable --- ElectronClient/app/gui/NoteText.jsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index 56db6f4be..4c139decc 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -36,8 +36,7 @@ class NoteTextComponent extends React.Component { isLoading: true, webviewReady: false, scrollHeight: null, - editorScrollTop: 0, - editor:null + editorScrollTop: 0 }; this.lastLoadedNoteId_ = null; @@ -168,9 +167,8 @@ class NoteTextComponent extends React.Component { async componentWillReceiveProps(nextProps) { if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) { await this.reloadNote(nextProps); - const editor=this.state.editor; - if(editor){ - const session = editor.getSession(); + if(this.editor_){ + const session = this.editor_.editor.getSession(); const undoManager = session.getUndoManager(); undoManager.reset(); session.setUndoManager(undoManager); @@ -342,9 +340,6 @@ class NoteTextComponent extends React.Component { this.scheduleSave(); } - aceEditor_onLoad(editor){ - this.setState({editor:editor}); - } async commandAttachFile() { const noteId = this.props.noteId; @@ -570,7 +565,6 @@ class NoteTextComponent extends React.Component { height={editorStyle.height + 'px'} fontSize={editorStyle.fontSize} showGutter={false} - onLoad={editor => this.aceEditor_onLoad.bind(this)(editor)} name="note-editor" wrapEnabled={true} onScroll={(event) => { this.editor_scroll(); }}