diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index df674c74e..b08ee9a2b 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -28,7 +28,8 @@ let liveScroll = true; const isElementCodeMirror=(element)=>{ let el = element; while( el.tagName != 'body' ) { - if( el.classList.contains('CodeMirror-code') || el.classList.contains('CodeMirror-line')) + if ( !el?.classList ) return false + if( el?.classList?.contains('CodeMirror-code') || el.classList.contains('CodeMirror-line')) return true; el = el.parentNode; } @@ -43,6 +44,7 @@ const Editor = createClass({ text : '', style : '' }, + liveScroll : true, onTextChange : ()=>{}, onStyleChange : ()=>{}, @@ -99,6 +101,9 @@ const Editor = createClass({ if(prevProps.moveSource !== this.props.moveSource) { this.sourceJump(); }; + if(prevProps.liveScroll !== this.props.liveScroll) { + liveScroll = !liveScroll; + }; }, handleControlKeys : function(e){ @@ -126,10 +131,7 @@ const Editor = createClass({ if ((e.shiftKey) && (!e.altKey) && (e.keyCode == J_KEY)) this.sourceJump(); // Toggle Live-scrolling on Shift-CTRL-ALT-J if((e.shiftKey) && (e.altKey) && (e.keyCode == J_KEY)) { - console.log('Trying to flip the property?') - console.log(liveScroll); liveScroll = !liveScroll; - console.log(liveScroll); } if( e.keyCode == J_KEY) { diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 2101480dc..0718a97b1 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -20,6 +20,7 @@ const SplitPane = createClass({ isDragging : false, moveSource : false, moveBrew : false, + liveScroll : true, showMoveArrows : true }; }, @@ -117,6 +118,20 @@ const SplitPane = createClass({ onClick={()=>this.setState({ moveBrew: !this.state.moveBrew })} > +