fix #215
This commit is contained in:
parent
fcbb12ba13
commit
df495997f8
1 changed files with 7 additions and 4 deletions
|
@ -52,8 +52,7 @@ class IDEView extends React.Component {
|
||||||
|
|
||||||
// if autosave is on and the user is the owner of the project
|
// if autosave is on and the user is the owner of the project
|
||||||
if (this.props.preferences.autosave
|
if (this.props.preferences.autosave
|
||||||
&& this.props.project.owner
|
&& this.isUserOwner()) {
|
||||||
&& this.props.project.owner.id === this.props.user.id) {
|
|
||||||
this.autosaveInterval = setInterval(this.props.autosaveProject, 30000);
|
this.autosaveInterval = setInterval(this.props.autosaveProject, 30000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +103,7 @@ class IDEView extends React.Component {
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
// if user is the owner of the project
|
// if user is the owner of the project
|
||||||
if (this.props.project.owner && this.props.project.owner.id === this.props.user.id) {
|
if (this.isUserOwner()) {
|
||||||
// if the user turns on autosave
|
// if the user turns on autosave
|
||||||
// or the user saves the project for the first time
|
// or the user saves the project for the first time
|
||||||
if (!this.autosaveInterval &&
|
if (!this.autosaveInterval &&
|
||||||
|
@ -135,6 +134,10 @@ class IDEView extends React.Component {
|
||||||
this.sidebarSize = undefined;
|
this.sidebarSize = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isUserOwner() {
|
||||||
|
return this.props.project.owner && this.props.project.owner.id === this.props.user.id;
|
||||||
|
}
|
||||||
|
|
||||||
_handleConsolePaneOnDragFinished() {
|
_handleConsolePaneOnDragFinished() {
|
||||||
this.consoleSize = this.refs.consolePane.state.draggedSize;
|
this.consoleSize = this.refs.consolePane.state.draggedSize;
|
||||||
this.refs.consolePane.setState({
|
this.refs.consolePane.setState({
|
||||||
|
@ -156,7 +159,7 @@ class IDEView extends React.Component {
|
||||||
if (e.keyCode === 83 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
|
if (e.keyCode === 83 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (this.props.project.owner && this.props.project.owner.id === this.props.user.id) {
|
if (this.isUserOwner() || this.props.user.authenticated && !this.props.project.owner) {
|
||||||
this.props.saveProject();
|
this.props.saveProject();
|
||||||
}
|
}
|
||||||
// 13 === enter
|
// 13 === enter
|
||||||
|
|
Loading…
Reference in a new issue