0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 00:12:56 +00:00

Merge branch 'master' into SwappableThemes-ReorganizeFolderStructure

This commit is contained in:
Trevor Buckner
2022-06-21 16:07:00 -04:00
23 changed files with 22868 additions and 22605 deletions

View File

@@ -30,6 +30,8 @@ if(typeof navigator !== 'undefined'){
// require('codemirror/addon/edit/trailingspace.js');
//Active line highlighting
// require('codemirror/addon/selection/active-line.js');
//Scroll past last line
require('codemirror/addon/scroll/scrollpastend.js');
//Auto-closing
//XML code folding is a requirement of the auto-closing tag feature and is not enabled
require('codemirror/addon/fold/xml-fold.js');
@@ -98,6 +100,7 @@ const CodeEditor = createClass({
indentWithTabs : true,
tabSize : 2,
historyEventDelay : 250,
scrollPastEnd : true,
extraKeys : {
'Ctrl-B' : this.makeBold,
'Cmd-B' : this.makeBold,

View File

@@ -3,6 +3,11 @@
@import (less) 'codemirror/addon/search/matchesonscrollbar.css';
@import (less) 'codemirror/addon/dialog/dialog.css';
@keyframes sourceMoveAnimation {
50% {background-color: red; color: white;}
100% {background-color: unset; color: unset;}
}
.codeEditor{
.CodeMirror-foldmarker {
font-family: inherit;
@@ -10,6 +15,11 @@
font-weight: 600;
}
.sourceMoveFlash .CodeMirror-line{
animation-name: sourceMoveAnimation;
animation-duration: 0.4s;
}
//.cm-tab {
// background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAQAAACOs/baAAAARUlEQVR4nGJgIAG8JkXxUAcCtDWemcGR1lY4MvgzCEKY7jSBjgxBDAG09UEQzAe0AMwMHrSOAwEGRtpaMIwAAAAA//8DAG4ID9EKs6YqAAAAAElFTkSuQmCC) no-repeat right;
//}
@@ -19,4 +29,4 @@
// background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAQAgMAAABW5NbuAAAACVBMVEVHcEwAAAAAAAAWawmTAAAAA3RSTlMAPBJ6PMxpAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAFUlEQVQI12NgwACcCQysASAEZGAAACMuAX06aCQUAAAAAElFTkSuQmCC) no-repeat right;
// }
//}
}
}

View File

@@ -17,7 +17,10 @@ const SplitPane = createClass({
return {
currentDividerPos : null,
windowWidth : 0,
isDragging : false
isDragging : false,
moveSource : false,
moveBrew : false,
showMoveArrows : true
};
},
@@ -29,6 +32,11 @@ const SplitPane = createClass({
userSetDividerPos : dividerPos,
windowWidth : window.innerWidth
});
} else {
this.setState({
currentDividerPos : window.innerWidth / 2,
userSetDividerPos : window.innerWidth / 2
});
}
window.addEventListener('resize', this.handleWindowResize);
},
@@ -83,20 +91,58 @@ const SplitPane = createClass({
window.getSelection().removeAllRanges();
}
},
*/
*/
setMoveArrows : function(newState) {
if(this.state.showMoveArrows != newState){
this.setState({
showMoveArrows : newState
});
}
},
renderMoveArrows : function(){
if(this.state.showMoveArrows) {
return <>
<div className='arrow left'
style={{ left: this.state.currentDividerPos-4 }}
onClick={()=>this.setState({ moveSource: !this.state.moveSource })} >
<i className='fas fa-arrow-left' />
</div>
<div className='arrow right'
style={{ left: this.state.currentDividerPos-4 }}
onClick={()=>this.setState({ moveBrew: !this.state.moveBrew })} >
<i className='fas fa-arrow-right' />
</div>
</>;
}
},
renderDivider : function(){
return <div className='divider' onMouseDown={this.handleDown} >
<div className='dots'>
<i className='fas fa-circle' />
<i className='fas fa-circle' />
<i className='fas fa-circle' />
return <>
{this.renderMoveArrows()}
<div className='divider' onMouseDown={this.handleDown} >
<div className='dots'>
<i className='fas fa-circle' />
<i className='fas fa-circle' />
<i className='fas fa-circle' />
</div>
</div>
</div>;
</>;
},
render : function(){
return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}>
<Pane ref='pane1' width={this.state.currentDividerPos}>{this.props.children[0]}</Pane>
<Pane
ref='pane1'
width={this.state.currentDividerPos}
>
{React.cloneElement(this.props.children[0], {
moveBrew : this.state.moveBrew,
moveSource : this.state.moveSource,
setMoveArrows : this.setMoveArrows
})}
</Pane>
{this.renderDivider()}
<Pane ref='pane2' isDragging={this.state.isDragging}>{this.props.children[1]}</Pane>
</div>;

View File

@@ -13,7 +13,7 @@
.divider{
display : table;
height : 100%;
width : 12px;
width : 15px;
cursor : ew-resize;
background-color : #bbb;
text-align : center;
@@ -32,4 +32,28 @@
background-color: #999;
}
}
.arrow{
position : absolute;
width : 25px;
height : 25px;
border : 2px solid #bbb;
border-radius : 15px;
text-align : center;
font-size : 1.2em;
cursor : pointer;
background-color : #ddd;
z-index : 999;
box-shadow : 0 4px 5px #0000007f;
&.left{
.tooltipLeft('Jump to location in Editor');
top : 30px;
}
&.right{
.tooltipRight('Jump to location in Preview');
top : 60px;
}
&:hover{
background-color: #666;
}
}
}