Explorar o código

fix #579 - ensure not to invoke setCaretLine method when componentDidMount

Yuki Takei %!s(int64=7) %!d(string=hai) anos
pai
achega
88082cdb01

+ 2 - 3
resource/js/components/PageEditor/CodeMirrorEditor.js

@@ -114,9 +114,6 @@ export default class CodeMirrorEditor extends AbstractEditor {
   componentDidMount() {
   componentDidMount() {
     // ensure to be able to resolve 'this' to use 'codemirror.commands.save'
     // ensure to be able to resolve 'this' to use 'codemirror.commands.save'
     this.getCodeMirror().codeMirrorEditor = this;
     this.getCodeMirror().codeMirrorEditor = this;
-
-    // initialize caret line
-    this.setCaretLine(0);
   }
   }
 
 
   componentWillReceiveProps(nextProps) {
   componentWillReceiveProps(nextProps) {
@@ -182,6 +179,8 @@ export default class CodeMirrorEditor extends AbstractEditor {
       return;
       return;
     }
     }
 
 
+    console.log('setCaretLine');
+
     const editor = this.getCodeMirror();
     const editor = this.getCodeMirror();
     const linePosition = Math.max(0, line);
     const linePosition = Math.max(0, line);
 
 

+ 0 - 5
resource/js/components/PageEditor/Editor.js

@@ -32,11 +32,6 @@ export default class Editor extends AbstractEditor {
     this.renderDropzoneOverlay = this.renderDropzoneOverlay.bind(this);
     this.renderDropzoneOverlay = this.renderDropzoneOverlay.bind(this);
   }
   }
 
 
-  componentDidMount() {
-    // initialize caret line
-    this.setCaretLine(0);
-  }
-
   getEditorSubstance() {
   getEditorSubstance() {
     return this.props.isMobile
     return this.props.isMobile
       ? this.refs.taEditor
       ? this.refs.taEditor