1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-04 19:16:07 +02:00

Removed duplicate editor variable

This commit is contained in:
marcosvega91 2017-12-22 15:43:01 +01:00
parent 0bf5c9ebdd
commit 38c050b47e

View File

@ -36,8 +36,7 @@ class NoteTextComponent extends React.Component {
isLoading: true, isLoading: true,
webviewReady: false, webviewReady: false,
scrollHeight: null, scrollHeight: null,
editorScrollTop: 0, editorScrollTop: 0
editor:null
}; };
this.lastLoadedNoteId_ = null; this.lastLoadedNoteId_ = null;
@ -168,9 +167,8 @@ class NoteTextComponent extends React.Component {
async componentWillReceiveProps(nextProps) { async componentWillReceiveProps(nextProps) {
if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) { if ('noteId' in nextProps && nextProps.noteId !== this.props.noteId) {
await this.reloadNote(nextProps); await this.reloadNote(nextProps);
const editor=this.state.editor; if(this.editor_){
if(editor){ const session = this.editor_.editor.getSession();
const session = editor.getSession();
const undoManager = session.getUndoManager(); const undoManager = session.getUndoManager();
undoManager.reset(); undoManager.reset();
session.setUndoManager(undoManager); session.setUndoManager(undoManager);
@ -342,9 +340,6 @@ class NoteTextComponent extends React.Component {
this.scheduleSave(); this.scheduleSave();
} }
aceEditor_onLoad(editor){
this.setState({editor:editor});
}
async commandAttachFile() { async commandAttachFile() {
const noteId = this.props.noteId; const noteId = this.props.noteId;
@ -570,7 +565,6 @@ class NoteTextComponent extends React.Component {
height={editorStyle.height + 'px'} height={editorStyle.height + 'px'}
fontSize={editorStyle.fontSize} fontSize={editorStyle.fontSize}
showGutter={false} showGutter={false}
onLoad={editor => this.aceEditor_onLoad.bind(this)(editor)}
name="note-editor" name="note-editor"
wrapEnabled={true} wrapEnabled={true}
onScroll={(event) => { this.editor_scroll(); }} onScroll={(event) => { this.editor_scroll(); }}