From eca39369defb2910228a458bd236cd125488811d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 29 May 2022 15:18:35 +1200 Subject: [PATCH] Initial pass at split pane button functionality --- client/homebrew/editor/editor.jsx | 8 +++++++- shared/naturalcrit/splitPane/splitPane.jsx | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 3caf229fc..a40c656c7 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -61,8 +61,14 @@ const Editor = createClass({ window.removeEventListener('resize', this.updateEditorSize); }, - componentDidUpdate : function() { + componentDidUpdate : function(prevProps, prevState, snapshot) { this.highlightCustomMarkdown(); + if(prevProps.moveBrew !== this.props.moveBrew) { + this.brewJump(); + }; + if(prevProps.moveSource !== this.props.moveSource) { + this.sourceJump(); + }; }, updateEditorSize : function() { diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index bc7e73905..c19ffe3ac 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -17,7 +17,9 @@ const SplitPane = createClass({ return { currentDividerPos : null, windowWidth : 0, - isDragging : false + isDragging : false, + moveSource : false, + moveBrew : false }; }, @@ -93,12 +95,12 @@ const SplitPane = createClass({ return <>
console.log('left')} > + onClick={()=>this.setState({ moveSource: !this.state.moveSource })} >
console.log('right')} > + onClick={()=>this.setState({ moveBrew: !this.state.moveBrew })} >
@@ -113,7 +115,15 @@ const SplitPane = createClass({ render : function(){ return
- {this.props.children[0]} + + {React.cloneElement(this.props.children[0], { + moveBrew : this.state.moveBrew, + moveSource : this.state.moveSource + })} + {this.renderDivider()} {this.props.children[1]}
;