diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 7a8dcb061..d79ef4a98 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -27,6 +27,7 @@ var Editor = React.createClass({ ch : 0 }, + componentDidMount: function() { this.updateEditorSize(); window.addEventListener("resize", this.updateEditorSize); @@ -39,8 +40,6 @@ var Editor = React.createClass({ var paneHeight = this.refs.main.parentNode.clientHeight; paneHeight -= this.refs.snippetBar.clientHeight + 1; this.refs.codeEditor.codeMirror.setSize(null, paneHeight); - - this.refs.codeEditor.updateSize(); }, handleTextChange : function(text){ @@ -58,6 +57,10 @@ var Editor = React.createClass({ this.refs.codeEditor.setCursorPosition(this.cursorPosition.line, this.cursorPosition.ch + injectText.length); }, + //Called when there are changes to the editor's dimensions + update : function(){ + this.refs.codeEditor.updateSize(); + }, renderSnippetGroups : function(){ return _.map(Snippets, (snippetGroup)=>{