@@ -92,7 +92,7 @@ class IDEView extends React.Component {
92
92
}
93
93
94
94
componentDidUpdate ( prevProps ) {
95
- if ( this . isUserOwner ( ) && this . props . project . id ) {
95
+ if ( this . isUserOwner ( this . props ) && this . props . project . id ) {
96
96
if ( this . props . preferences . autosave && this . props . ide . unsavedChanges && ! this . props . ide . justOpenedProject ) {
97
97
if (
98
98
this . props . selectedFile . name === prevProps . selectedFile . name &&
@@ -123,21 +123,19 @@ class IDEView extends React.Component {
123
123
this . autosaveInterval = null ;
124
124
}
125
125
126
- getTitle = ( ) => {
127
- const { id } = this . props . project ;
128
- return id ? `p5.js Web Editor | ${ this . props . project . name } ` : 'p5.js Web Editor' ;
126
+ getTitle = ( props ) => {
127
+ const { id } = props . project ;
128
+ return id ? `p5.js Web Editor | ${ props . project . name } ` : 'p5.js Web Editor' ;
129
129
}
130
130
131
- isUserOwner ( ) {
132
- return this . props . project . owner && this . props . project . owner . id === this . props . user . id ;
133
- }
131
+ isUserOwner = props => props . project . owner && props . project . owner . id === props . user . id ;
134
132
135
133
handleGlobalKeydown ( e ) {
136
134
// 83 === s
137
135
if ( e . keyCode === 83 && ( ( e . metaKey && this . isMac ) || ( e . ctrlKey && ! this . isMac ) ) ) {
138
136
e . preventDefault ( ) ;
139
137
e . stopPropagation ( ) ;
140
- if ( this . isUserOwner ( ) || ( this . props . user . authenticated && ! this . props . project . owner ) ) {
138
+ if ( this . isUserOwner ( this . props ) || ( this . props . user . authenticated && ! this . props . project . owner ) ) {
141
139
this . props . saveProject ( this . cmController . getContent ( ) ) ;
142
140
} else if ( this . props . user . authenticated ) {
143
141
this . props . cloneProject ( ) ;
@@ -208,7 +206,7 @@ class IDEView extends React.Component {
208
206
return (
209
207
< div className = "ide" >
210
208
< Helmet >
211
- < title > { this . getTitle ( ) } </ title >
209
+ < title > { this . getTitle ( this . props ) } </ title >
212
210
</ Helmet >
213
211
{ this . props . toast . isVisible && < Toast /> }
214
212
< Nav
@@ -313,7 +311,7 @@ class IDEView extends React.Component {
313
311
isExpanded = { this . props . ide . sidebarIsExpanded }
314
312
expandSidebar = { this . props . expandSidebar }
315
313
collapseSidebar = { this . props . collapseSidebar }
316
- isUserOwner = { this . isUserOwner ( ) }
314
+ isUserOwner = { this . isUserOwner ( this . props ) }
317
315
clearConsole = { this . props . clearConsole }
318
316
consoleEvents = { this . props . console }
319
317
showRuntimeErrorWarning = { this . props . showRuntimeErrorWarning }
0 commit comments