Skip to content

Commit 560659e

Browse files
authored
Merge pull request #1183 from processing/bug/add-file
fixes #1180
2 parents 6139030 + 53241c9 commit 560659e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/components/Nav.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ class Nav extends React.PureComponent {
129129
}
130130

131131
handleAddFile() {
132-
this.props.newFile();
132+
this.props.newFile(this.props.rootFile.id);
133133
this.setDropdown('none');
134134
}
135135

136136
handleAddFolder() {
137-
this.props.newFolder();
137+
this.props.newFolder(this.props.rootFile.id);
138138
this.setDropdown('none');
139139
}
140140

@@ -662,7 +662,8 @@ Nav.propTypes = {
662662
stopSketch: PropTypes.func.isRequired,
663663
setAllAccessibleOutput: PropTypes.func.isRequired,
664664
newFile: PropTypes.func.isRequired,
665-
newFolder: PropTypes.func.isRequired
665+
newFolder: PropTypes.func.isRequired,
666+
rootFile: PropTypes.func.isRequired
666667
};
667668

668669
Nav.defaultProps = {
@@ -677,7 +678,8 @@ function mapStateToProps(state) {
677678
return {
678679
project: state.project,
679680
user: state.user,
680-
unsavedChanges: state.ide.unsavedChanges
681+
unsavedChanges: state.ide.unsavedChanges,
682+
rootFile: state.files.filter(file => file.name === 'root')[0]
681683
};
682684
}
683685

0 commit comments

Comments
 (0)