diff --git a/src/components/incubator/EditingWorkspace.tsx b/src/components/incubator/EditingWorkspace.tsx index 81e08fbeba..592dbdae6f 100644 --- a/src/components/incubator/EditingWorkspace.tsx +++ b/src/components/incubator/EditingWorkspace.tsx @@ -81,7 +81,6 @@ interface IState { assessment: IAssessment | null; activeTab: number; editingMode: string; - editorPersist: boolean; hasUnsavedChanges: boolean; showResetOverlay: boolean; originalMaxGrade: number; @@ -95,7 +94,6 @@ class AssessmentWorkspace extends React.Component { - if (checkPersist || !this.state.editorPersist) { - const question: IQuestion = this.state.assessment!.questions[this.formatedQuestionId()]; - let editorValue: string; - if (question.type === QuestionTypes.programming) { - if (question.editorValue) { - editorValue = question.editorValue; - } else { - editorValue = (question as IProgrammingQuestion).solutionTemplate as string; - } + private resetEditorValue = () => { + const question: IQuestion = this.state.assessment!.questions[this.formatedQuestionId()]; + let editorValue: string; + if (question.type === QuestionTypes.programming) { + if (question.editorValue) { + editorValue = question.editorValue; } else { - editorValue = '//If you see this, this is a bug. Please report bug.'; + editorValue = (question as IProgrammingQuestion).solutionTemplate as string; } - this.props.handleResetWorkspace({ editorValue }); - this.props.handleEditorValueChange(editorValue); + } else { + editorValue = '//If you see this, this is a bug. Please report bug.'; } + this.props.handleResetWorkspace({ editorValue }); + this.props.handleEditorValueChange(editorValue); }; private handleSave = () => { @@ -374,12 +369,6 @@ class AssessmentWorkspace extends React.Component { - // this.setState({ - // editorPersist: !this.state.editorPersist - // }); - // }; - /** Pre-condition: IAssessment has been loaded */ private sideContentProps: (p: AssessmentWorkspaceProps, q: number) => SideContentProps = ( props: AssessmentWorkspaceProps, @@ -565,8 +554,6 @@ class AssessmentWorkspace extends React.Component void; handleReplOutputClear: () => void; handleToggleEditorAutorun?: () => void; - handleToggleEditorPersist?: () => void; hasChapterSelect: boolean; hasEditorAutorunButton: boolean; hasSaveButton: boolean; hasShareButton: boolean; hasUnsavedChanges?: boolean; - isEditorPersist?: boolean; isEditorAutorun?: boolean; isRunning: boolean; editingMode?: string; @@ -146,14 +144,6 @@ class ControlBar extends React.PureComponent { this.props.onClickReset !== null ? controlButton('Reset', IconNames.REPEAT, this.props.onClickReset) : undefined; - const editorPersistSwitch = - this.props.handleToggleEditorPersist !== undefined - ? controlButton( - 'Editor Persistence ' + (this.props.isEditorPersist ? 'Enabled' : 'Disabled'), - this.props.isEditorPersist ? IconNames.TICK : IconNames.CROSS, - this.props.handleToggleEditorPersist - ) - : undefined; return (
{this.props.isEditorAutorun ? undefined : this.props.isRunning ? stopButton : runButton} @@ -161,7 +151,6 @@ class ControlBar extends React.PureComponent { {shareButton} {chapterSelectButton} {externalSelectButton} {this.props.isEditorAutorun ? stopAutorunButton : startAutorunButton} {resetButton} - {editorPersistSwitch}
); }