diff --git a/frontend/package.json b/frontend/package.json index 6ed231a385aa98dae3d39974ca4d24efde8d638c..74cd718cf10f5f458e8c4ecac6609ecf9b671f28 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "axios": "^0.18.0", "file-saver": "^2.0.2", "highlight.js": "^9.12.0", + "marked":"^4.0.18", "v-clipboard": "^2.0.1", "vue": "^2.6.12", "vue-class-component": "^6.0.0", diff --git a/frontend/src/components/submission_notes/CorrectionHelpCard.vue b/frontend/src/components/submission_notes/CorrectionHelpCard.vue index 0be45efe97d30fbbf616c525fd13d473644894fd..31af1cadba920b376f0abb3e413dcde4d1ebd014 100644 --- a/frontend/src/components/submission_notes/CorrectionHelpCard.vue +++ b/frontend/src/components/submission_notes/CorrectionHelpCard.vue @@ -5,21 +5,21 @@ <h3>Tips on using the correction interface</h3> </v-card-title> <v-card-text> + Markdown is rendered by default. <br> + Select the Σ button to choose to have math rendered or not. <br> + In case you need the un-rendered markdown, click the "Copy to Clipboard" button. <br> + Cick on the individual line numbers in order to add feedback for a specific line. <br> + After adding feedback to a line, clicking the feedback button will hide it or show it. <br> + When feedback is hidden, the lines that contain feedback will be highlighted in red. <br> + <!-- ------THE OLD FLAVOR TEXT, SAVED IN CASE IT IS NEEDED FOR SOME REASON (it is very cool) ------- Never trade an ale. The sea-dog leads with yellow fever, crush the captain's quarters until it waves.<br> Ho-ho-ho! malaria of life.<br> - Halitosis, adventure, and yellow fever.<br> - The girl drinks with halitosis, pull the galley before it laughs.<br> - The moon fires with life, vandalize the bikini atoll before it travels.<br> - The tuna blows with fight, haul the freighter before it whines.<br> - The cannibal robs with hunger, fire the lighthouse until it whines.<br> - The captain loves with death, vandalize the lighthouse before it whines.<br> - The anchor loots with treasure, raid the freighter before it grows.<br> - The reef commands with endurance, view the quarter-deck until it whines.<br> The scallywag loots with passion, crush the bikini atoll before it falls.<br> The sea leads with treasure, ransack the brig until it dies.<br> The parrot robs with desolation, view the seychelles before it screams.<br> The warm anchor quirky blows the landlubber.<br> + The warm anchor quirky blows the landlubber.<br> --> </v-card-text> </v-card> </template> diff --git a/frontend/src/components/submission_notes/base/SubmissionLine.vue b/frontend/src/components/submission_notes/base/SubmissionLine.vue index ee5537965cae1ba4517b851a916e0173e81643e2..13eda29b055abb3a08f5cb5db47c5ddadc723bb4 100644 --- a/frontend/src/components/submission_notes/base/SubmissionLine.vue +++ b/frontend/src/components/submission_notes/base/SubmissionLine.vue @@ -16,7 +16,11 @@ </td> <td class="code-cell-content pl-2"> <!-- eslint-disable-next-line --> - <span class="code-line" :key="key" v-html="code"/> + <span + :key="key" + class="code-line" + v-html="html" + /> <slot /> </td> </div> @@ -46,7 +50,9 @@ export default { }, data () { return { - key: 0 + key: 0, + html:'', + markdowned:true } }, computed: { @@ -58,6 +64,8 @@ export default { subNotesEventBus.$on('resetSubmission', () => { this.key++ }) + const {marked} = require('marked') + this.html = marked.parse(this.code) }, methods: { toggleEditor () { @@ -77,7 +85,7 @@ export default { } .code-line { - white-space: pre-wrap; + white-space: normal; font-family: monospace; } diff --git a/frontend/src/components/submission_notes/toolbars/AnnotatedSubmissionTopToolbar.vue b/frontend/src/components/submission_notes/toolbars/AnnotatedSubmissionTopToolbar.vue index 4f42298d67716667d7f9c13158e575d2527e1511..a60b143457438cd69d827fd8c66ad97eea191f85 100644 --- a/frontend/src/components/submission_notes/toolbars/AnnotatedSubmissionTopToolbar.vue +++ b/frontend/src/components/submission_notes/toolbars/AnnotatedSubmissionTopToolbar.vue @@ -23,12 +23,35 @@ Score: {{ score }} </span> <v-spacer /> <toggle-feedback-visibility-button /> + <div v-if="isMarkdown"> - <v-btn @click="$emit('input', !mathIsRendered)"> + <!-- <v-btn @click="$emit('input', !mathIsRendered)"> {{ mathIsRendered ? 'Reset Math' : 'Render Math' }} + </v-btn> --> + <v-btn + v-if="mathIsRendered" + text + color="info" + title="Math is being rendered" + :style="{backgroundColor: '#cce7ff'}" + @click="$emit('input', !mathIsRendered)" + > + <v-icon> + functions + </v-icon> + </v-btn> + <v-btn + v-else + text + color="grey" + title="Math is not being rendered" + @click="$emit('input', !mathIsRendered)" + > + <v-icon> + functions + </v-icon> </v-btn> </div> - <v-spacer /> <v-tooltip v-if="sourceCodeAvailable" top diff --git a/frontend/src/components/submission_notes/toolbars/ToggleFeedbackVisibilityButton.vue b/frontend/src/components/submission_notes/toolbars/ToggleFeedbackVisibilityButton.vue index 453a5ea8ca702d9ee9cea16587d01650da2f1992..2e207d5cd6534178f3b2ed89a866ca7d2b8a96b6 100644 --- a/frontend/src/components/submission_notes/toolbars/ToggleFeedbackVisibilityButton.vue +++ b/frontend/src/components/submission_notes/toolbars/ToggleFeedbackVisibilityButton.vue @@ -1,16 +1,26 @@ <template> <v-btn - id="feedback-visibility-toggle" + v-if="showFeedback" text color="info" + title="Feedback is being shown" + :style="{backgroundColor: '#cce7ff'}" @click="showFeedback = !showFeedback" > - <div v-if="showFeedback"> - Hide Feedback - </div> - <div v-else> - Show Feedback - </div> + <v-icon> + rate_review + </v-icon> + </v-btn> + <v-btn + v-else + text + color="grey" + title="Feedback is not being shown" + @click="showFeedback = !showFeedback" + > + <v-icon> + rate_review + </v-icon> </v-btn> </template>