diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 8e10085c8..91faadcb5 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -105,6 +105,21 @@ const SplitPane = createClass({ userSetDividerPos : newSize }); }, + + liveScrollToggle : function(e) { + const flipLiveScroll = !this.state.liveScroll; + const toggle = e.target; + const toggleDiv = toggle.parentElement; + if(flipLiveScroll) { + toggle.className = 'fas fa-lock'; + toggleDiv.className = 'arrow lock'; + } else { + toggle.className = 'fas fa-unlock'; + toggleDiv.className = 'arrow unlock'; + } + window.localStorage.setItem('liveScroll', String(flipLiveScroll)); + this.setState({ liveScroll: flipLiveScroll }); + }, /* unFocus : function() { if(document.selection){ @@ -138,20 +153,7 @@ const SplitPane = createClass({
{ - const flipLiveScroll = !this.state.liveScroll; - const toggle = document.getElementById('scrollToggle'); - const toggleDiv = document.getElementById('scrollToggleDiv'); - if(flipLiveScroll) { - toggle.className = 'fas fa-lock'; - toggleDiv.className = 'arrow lock'; - } else { - toggle.className = 'fas fa-unlock'; - toggleDiv.className = 'arrow unlock'; - } - window.localStorage.setItem('liveScroll', String(flipLiveScroll)); - this.setState({ liveScroll: flipLiveScroll }); - }} > + onClick={this.liveScrollToggle} >
;