From 185d8fdd050937dfc84e74da49e55b4ef67b881a Mon Sep 17 00:00:00 2001 From: Yining Shi Date: Wed, 19 Oct 2016 11:47:58 -0400 Subject: [PATCH] fixes #148 (#153) * save project after changing sketch name * not saving the sketch after updating the name if it's not created yet --- client/modules/IDE/components/Toolbar.js | 9 +++++++-- client/modules/IDE/pages/IDEView.js | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/modules/IDE/components/Toolbar.js b/client/modules/IDE/components/Toolbar.js index 77ad125f..8202ae2f 100644 --- a/client/modules/IDE/components/Toolbar.js +++ b/client/modules/IDE/components/Toolbar.js @@ -103,6 +103,9 @@ class Toolbar extends React.Component { onBlur={() => { this.validateProjectName(); this.props.hideEditProjectName(); + if (this.props.project.id) { + this.props.saveProject(); + } }} onKeyPress={this.handleKeyPress} /> @@ -142,14 +145,16 @@ Toolbar.propTypes = { }), project: PropTypes.shape({ name: PropTypes.string.isRequired, - isEditingName: PropTypes.bool + isEditingName: PropTypes.bool, + id: PropTypes.string }).isRequired, showEditProjectName: PropTypes.func.isRequired, hideEditProjectName: PropTypes.func.isRequired, infiniteLoop: PropTypes.bool.isRequired, autorefresh: PropTypes.bool.isRequired, setAutorefresh: PropTypes.func.isRequired, - startSketchAndRefresh: PropTypes.func.isRequired + startSketchAndRefresh: PropTypes.func.isRequired, + saveProject: PropTypes.func.isRequired }; export default Toolbar; diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index c3bd9b0d..cd1278a5 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -196,6 +196,7 @@ class IDEView extends React.Component { autorefresh={this.props.preferences.autorefresh} setAutorefresh={this.props.setAutorefresh} startSketchAndRefresh={this.props.startSketchAndRefresh} + saveProject={this.props.saveProject} />