mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 22:52:40 +00:00
* Include two versions of Marked.js
* Include two versions of Marked.js
* Working two different render pipelines
Adds stylesheet "styleLegacy.less"
Adds markdownHandler "markdownLegacy.js"
The BrewRenderer will switch between these and the new pipeline dependent on the "version" prop passed in.
* Mustache-style div blocks
* Legacy snippets & columnbreak
* Codemirror styling for Div Blocks
* Lint
* Codemirror highlights for inline Divs as well
These will turn red `{{class Content}}`
Multi-line divs will turn purple
```
{{class,class2
content
}}
```
No real need for these to be different colors. Just for testing.
* More lint
* Update dependencies.
* Adding Button to switch render pipelines
* Update Marked.js
* Popup alert to refresh page when renderer changed
* Don't compress files in Development (very slow)
* Block DIV or inline Span depending on {{ placement
* \column emits a Div instead of Span
* Allow share page to use new renderer
* {{ divs no longer need empty lines. Spans work in lists.
* Typo
* Typo
* Enforce \page must be at start of line. Code cleanup.
* Inject newlines after/before {{/}} to avoid needing blank lines
* Fixes issues with tables.
* Remove console.log
* Fix spacing issue for Spans
* Move things from Brewrenderer to Markdown
Try to keep all custom text fiddling in one spot.
* Rename variables
* Update Font-Awesome to v5.15. Fix style issues on popups.
* Update {{ Divs/Spans, Fix nested hilighting
* Fixed Spans/divs with no tags or just commas
* Use blacklist for {{ to allow more characters
* Update package-lock.json
* Update all icons to Font-awesome 5
* V3 hidden behind config variable
Add "globalThis.enable_v3 = true" in the console to enable.
* lint
101 lines
2.3 KiB
JavaScript
101 lines
2.3 KiB
JavaScript
require('./splitPane.less');
|
|
const React = require('react');
|
|
const createClass = require('create-react-class');
|
|
const _ = require('lodash');
|
|
const cx = require('classnames');
|
|
|
|
const SplitPane = createClass({
|
|
getDefaultProps : function() {
|
|
return {
|
|
storageKey : 'naturalcrit-pane-split',
|
|
onDragFinish : function(){} //fires when dragging
|
|
|
|
};
|
|
},
|
|
getInitialState : function() {
|
|
return {
|
|
size : null,
|
|
isDragging : false
|
|
};
|
|
},
|
|
componentDidMount : function() {
|
|
const paneSize = window.localStorage.getItem(this.props.storageKey);
|
|
if(paneSize){
|
|
this.setState({
|
|
size : paneSize
|
|
});
|
|
}
|
|
},
|
|
|
|
handleUp : function(){
|
|
if(this.state.isDragging){
|
|
this.props.onDragFinish(this.state.size);
|
|
window.localStorage.setItem(this.props.storageKey, this.state.size);
|
|
}
|
|
this.setState({ isDragging: false });
|
|
},
|
|
handleDown : function(){
|
|
this.setState({ isDragging: true });
|
|
//this.unFocus()
|
|
},
|
|
handleMove : function(e){
|
|
if(!this.state.isDragging) return;
|
|
this.setState({
|
|
size : e.pageX
|
|
});
|
|
},
|
|
/*
|
|
unFocus : function() {
|
|
if(document.selection){
|
|
document.selection.empty();
|
|
}else{
|
|
window.getSelection().removeAllRanges();
|
|
}
|
|
},
|
|
*/
|
|
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' />
|
|
</div>
|
|
</div>;
|
|
},
|
|
|
|
render : function(){
|
|
return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}>
|
|
<Pane ref='pane1' width={this.state.size}>{this.props.children[0]}</Pane>
|
|
{this.renderDivider()}
|
|
<Pane ref='pane2' isDragging={this.state.isDragging}>{this.props.children[1]}</Pane>
|
|
</div>;
|
|
}
|
|
});
|
|
|
|
const Pane = createClass({
|
|
getDefaultProps : function() {
|
|
return {
|
|
width : null
|
|
};
|
|
},
|
|
render : function(){
|
|
let styles = {};
|
|
if(this.props.width){
|
|
styles = {
|
|
flex : 'none',
|
|
width : `${this.props.width}px`
|
|
};
|
|
} else {
|
|
styles = {
|
|
pointerEvents : this.props.isDragging ? 'none' : 'auto' //Disable mouse capture in the rightmost pane; dragging into the iframe drops the divider otherwise
|
|
};
|
|
}
|
|
|
|
return <div className={cx('pane', this.props.className)} style={styles}>
|
|
{this.props.children}
|
|
</div>;
|
|
}
|
|
});
|
|
|
|
module.exports = SplitPane;
|