0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-15 10:32:45 +00:00

update editor ref's in edit, home, and new pages.

This commit is contained in:
Gazook89
2024-05-16 23:29:30 -05:00
parent 78ce8aa6e3
commit 7c9cc25923
3 changed files with 16 additions and 9 deletions

View File

@@ -54,6 +54,8 @@ const EditPage = createClass({
currentEditorPage : 0
};
},
editor : React.createRef(null),
savedBrew : null,
componentDidMount : function(){
@@ -101,7 +103,7 @@ const EditPage = createClass({
},
handleSplitMove : function(){
this.refs.editor.update();
this.editor.current.update();
},
handleTextChange : function(text){
@@ -113,7 +115,7 @@ const EditPage = createClass({
brew : { ...prevState.brew, text: text },
isPending : true,
htmlErrors : htmlErrors,
currentEditorPage : this.refs.editor.getCurrentPage() - 1 //Offset index since Marked starts pages at 0
currentEditorPage : this.editor.current.getCurrentPage() - 1 //Offset index since Marked starts pages at 0
}), ()=>{if(this.state.autoSave) this.trySave();});
},
@@ -392,7 +394,7 @@ const EditPage = createClass({
<div className='content'>
<SplitPane onDragFinish={this.handleSplitMove}>
<Editor
ref='editor'
ref={this.editor}
brew={this.state.brew}
onTextChange={this.handleTextChange}
onStyleChange={this.handleStyleChange}