From 7c9cc2592382c0506e7dd2368e8856c44e669537 Mon Sep 17 00:00:00 2001 From: Gazook89 Date: Thu, 16 May 2024 23:29:30 -0500 Subject: [PATCH] update editor ref's in edit, home, and new pages. --- client/homebrew/pages/editPage/editPage.jsx | 8 +++++--- client/homebrew/pages/homePage/homePage.jsx | 9 ++++++--- client/homebrew/pages/newPage/newPage.jsx | 8 +++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 0086a7c9a..3e7bd0c2a 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -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({
({ brew : { ...prevState.brew, text: text }, - 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 })); }, renderNavbar : function(){ @@ -81,7 +84,7 @@ const HomePage = createClass({
({ brew : { ...prevState.brew, text: text }, 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 })); localStorage.setItem(BREWKEY, text); }, @@ -215,7 +217,7 @@ const NewPage = createClass({