mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 20:42:44 +00:00
Editor and renderer redraw when you resize the browser
This commit is contained in:
@@ -7,6 +7,9 @@
|
|||||||
- If you visit a deleted brew, it will now remove it from your recent list. (Thanks u/sIllverback!)
|
- If you visit a deleted brew, it will now remove it from your recent list. (Thanks u/sIllverback!)
|
||||||
- Improved parsing of embedded html text in brews. (Thanks u/com-charizard!)
|
- Improved parsing of embedded html text in brews. (Thanks u/com-charizard!)
|
||||||
- Added in a new coverpage snippet
|
- Added in a new coverpage snippet
|
||||||
|
- Homebrewery will now try and onsert a good title for your brew if you don't provide one
|
||||||
|
- Homebrewery now re-renders properly when you zoom
|
||||||
|
|
||||||
|
|
||||||
### Friday, 29/07/2016 - v2.2.7
|
### Friday, 29/07/2016 - v2.2.7
|
||||||
- Adding in descriptive note blocks. (Thanks calculuschild!)
|
- Adding in descriptive note blocks. (Thanks calculuschild!)
|
||||||
|
|||||||
@@ -23,11 +23,20 @@ var BrewRenderer = React.createClass({
|
|||||||
height : 0,
|
height : 0,
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
this.updateSize();
|
||||||
|
window.addEventListener("resize", this.updateSize);
|
||||||
|
},
|
||||||
|
componentWillUnmount: function() {
|
||||||
|
window.removeEventListener("resize", this.updateSize);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSize : function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
height : this.refs.main.parentNode.clientHeight,
|
height : this.refs.main.parentNode.clientHeight,
|
||||||
isMounted : true
|
isMounted : true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleScroll : function(e){
|
handleScroll : function(e){
|
||||||
this.setState({
|
this.setState({
|
||||||
viewablePageNumber : Math.floor(e.target.scrollTop / PAGE_HEIGHT)
|
viewablePageNumber : Math.floor(e.target.scrollTop / PAGE_HEIGHT)
|
||||||
|
|||||||
@@ -28,9 +28,19 @@ var Editor = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
this.updateEditorSize();
|
||||||
|
window.addEventListener("resize", this.updateEditorSize);
|
||||||
|
},
|
||||||
|
componentWillUnmount: function() {
|
||||||
|
window.removeEventListener("resize", this.updateEditorSize);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateEditorSize : function() {
|
||||||
var paneHeight = this.refs.main.parentNode.clientHeight;
|
var paneHeight = this.refs.main.parentNode.clientHeight;
|
||||||
paneHeight -= this.refs.snippetBar.clientHeight + 1;
|
paneHeight -= this.refs.snippetBar.clientHeight + 1;
|
||||||
this.refs.codeEditor.codeMirror.setSize(null, paneHeight);
|
this.refs.codeEditor.codeMirror.setSize(null, paneHeight);
|
||||||
|
|
||||||
|
this.refs.codeEditor.updateSize();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTextChange : function(text){
|
handleTextChange : function(text){
|
||||||
@@ -48,10 +58,6 @@ var Editor = React.createClass({
|
|||||||
this.refs.codeEditor.setCursorPosition(this.cursorPosition.line, this.cursorPosition.ch + injectText.length);
|
this.refs.codeEditor.setCursorPosition(this.cursorPosition.line, this.cursorPosition.ch + injectText.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
//Called when there are changes to the editor's dimensions
|
|
||||||
update : function(){
|
|
||||||
this.refs.codeEditor.updateSize();
|
|
||||||
},
|
|
||||||
|
|
||||||
renderSnippetGroups : function(){
|
renderSnippetGroups : function(){
|
||||||
return _.map(Snippets, (snippetGroup)=>{
|
return _.map(Snippets, (snippetGroup)=>{
|
||||||
|
|||||||
@@ -52,14 +52,7 @@ var EditPage = React.createClass({
|
|||||||
},
|
},
|
||||||
savedBrew : null,
|
savedBrew : null,
|
||||||
|
|
||||||
test : ()=>{
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount: function(){
|
componentDidMount: function(){
|
||||||
|
|
||||||
console.log('getting here');
|
|
||||||
|
|
||||||
this.debounceSave = _.debounce(this.save, SAVE_TIMEOUT);
|
this.debounceSave = _.debounce(this.save, SAVE_TIMEOUT);
|
||||||
window.onbeforeunload = ()=>{
|
window.onbeforeunload = ()=>{
|
||||||
if(this.state.isSaving || this.state.isPending){
|
if(this.state.isSaving || this.state.isPending){
|
||||||
|
|||||||
Reference in New Issue
Block a user