0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-08 05:22:40 +00:00

Move state change to handleViewChange

This commit is contained in:
G.Ambatte
2022-05-29 16:16:48 +12:00
parent ab8dd8ae76
commit 4cc3dd93e2

View File

@@ -96,6 +96,7 @@ const Editor = createClass({
}, },
handleViewChange : function(newView){ handleViewChange : function(newView){
this.props.setMoveArrows(newView === 'text');
this.setState({ this.setState({
view : newView view : newView
}, this.updateEditorSize); //TODO: not sure if updateeditorsize needed }, this.updateEditorSize); //TODO: not sure if updateeditorsize needed
@@ -232,7 +233,6 @@ const Editor = createClass({
renderEditor : function(){ renderEditor : function(){
if(this.isText()){ if(this.isText()){
this.props.setMoveArrows(true);
return <> return <>
<CodeEditor key='codeEditor' <CodeEditor key='codeEditor'
ref='codeEditor' ref='codeEditor'
@@ -244,7 +244,6 @@ const Editor = createClass({
</>; </>;
} }
if(this.isStyle()){ if(this.isStyle()){
this.props.setMoveArrows(false);
return <> return <>
<CodeEditor key='codeEditor' <CodeEditor key='codeEditor'
ref='codeEditor' ref='codeEditor'
@@ -257,7 +256,6 @@ const Editor = createClass({
</>; </>;
} }
if(this.isMeta()){ if(this.isMeta()){
this.props.setMoveArrows(false);
return <> return <>
<CodeEditor key='codeEditor' <CodeEditor key='codeEditor'
view={this.state.view} view={this.state.view}