@@ -81,7 +81,6 @@ interface IState {
81
81
assessment : IAssessment | null ;
82
82
activeTab : number ;
83
83
editingMode : string ;
84
- editorPersist : boolean ;
85
84
hasUnsavedChanges : boolean ;
86
85
showResetOverlay : boolean ;
87
86
originalMaxGrade : number ;
@@ -95,7 +94,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
95
94
assessment : retrieveLocalAssessment ( ) ,
96
95
activeTab : 0 ,
97
96
editingMode : 'question' ,
98
- editorPersist : false ,
99
97
hasUnsavedChanges : false ,
100
98
showResetOverlay : false ,
101
99
originalMaxGrade : 0 ,
@@ -222,7 +220,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
222
220
originalMaxXp : this . getMaxMarks ( 'maxXp' )
223
221
} ) ;
224
222
this . handleRefreshLibrary ( ) ;
225
- this . resetEditorValue ( ) ;
226
223
} ,
227
224
{ minimal : false , intent : Intent . DANGER }
228
225
) }
@@ -249,7 +246,7 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
249
246
this . props . storedAssessmentId !== assessmentId ||
250
247
this . props . storedQuestionId !== questionId
251
248
) {
252
- this . resetEditorValue ( false ) ;
249
+ this . resetEditorValue ( ) ;
253
250
this . props . handleUpdateCurrentAssessmentId ( assessmentId , questionId ) ;
254
251
this . props . handleUpdateHasUnsavedChanges ( false ) ;
255
252
if ( this . state . hasUnsavedChanges ) {
@@ -284,22 +281,20 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
284
281
this . props . handleClearContext ( library ) ;
285
282
} ;
286
283
287
- private resetEditorValue = ( checkPersist : boolean = true ) => {
288
- if ( checkPersist || ! this . state . editorPersist ) {
289
- const question : IQuestion = this . state . assessment ! . questions [ this . formatedQuestionId ( ) ] ;
290
- let editorValue : string ;
291
- if ( question . type === QuestionTypes . programming ) {
292
- if ( question . editorValue ) {
293
- editorValue = question . editorValue ;
294
- } else {
295
- editorValue = ( question as IProgrammingQuestion ) . solutionTemplate as string ;
296
- }
284
+ private resetEditorValue = ( ) => {
285
+ const question : IQuestion = this . state . assessment ! . questions [ this . formatedQuestionId ( ) ] ;
286
+ let editorValue : string ;
287
+ if ( question . type === QuestionTypes . programming ) {
288
+ if ( question . editorValue ) {
289
+ editorValue = question . editorValue ;
297
290
} else {
298
- editorValue = '//If you see this, this is a bug. Please report bug.' ;
291
+ editorValue = ( question as IProgrammingQuestion ) . solutionTemplate as string ;
299
292
}
300
- this . props . handleResetWorkspace ( { editorValue } ) ;
301
- this . props . handleEditorValueChange ( editorValue ) ;
293
+ } else {
294
+ editorValue = '//If you see this, this is a bug. Please report bug.' ;
302
295
}
296
+ this . props . handleResetWorkspace ( { editorValue } ) ;
297
+ this . props . handleEditorValueChange ( editorValue ) ;
303
298
} ;
304
299
305
300
private handleSave = ( ) => {
@@ -374,12 +369,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
374
369
} ) ;
375
370
} ;
376
371
377
- // private toggleEditorPersist = () => {
378
- // this.setState({
379
- // editorPersist: !this.state.editorPersist
380
- // });
381
- // };
382
-
383
372
/** Pre-condition: IAssessment has been loaded */
384
373
private sideContentProps : ( p : AssessmentWorkspaceProps , q : number ) => SideContentProps = (
385
374
props : AssessmentWorkspaceProps ,
@@ -565,8 +554,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
565
554
sourceChapter : this . state . assessment ! . questions [ questionId ] . library . chapter ,
566
555
editingMode : this . state . editingMode ,
567
556
toggleEditMode : this . toggleEditingMode
568
- // isEditorPersist: this.state.editorPersist,
569
- // handleToggleEditorPersist: this.toggleEditorPersist
570
557
} ;
571
558
} ;
572
559
}
0 commit comments