Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: Replace the remaining markdown editors with Monaco #9230

Merged
merged 91 commits into from
Aug 24, 2024

Conversation

pzdr7
Copy link
Contributor

@pzdr7 pzdr7 commented Aug 18, 2024

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

We want to remove Ace from Artemis. However, the Markdown Editor (except for communication and programming exercise problem statements) still uses Ace.

Description

Replaced every usage of the old markdown editor with Monaco:

  • Updating text, file upload, and modeling exercises
  • Legal documents (e.g. imprint)
  • Standardized competencies and course competencies/prerequisites
  • Exams and exam announcements
  • Lectures and lecture text units
  • Grading instructions (/ structured grading criteria)
  • DnD and MC quiz questions

Added editor actions for the grading instructions (criterion, instruction, credits, description, scale, feedback, and usage count) and multiple choice / dnd answers (wrong, correct, hint, explanation). These generally follow the same logic of the original markdown editor.

Note: I will remove the remaining references to Ace / Commands / EditorMode ... in a follow-up PR where I remove Ace from Artemis.

Steps for Testing

Default markdown editor

Prerequisites:

  • 1 Admin

Test the markdown editors. In particular, verify that your changes to the markdown text are saved and that you can see your changes in the preview.

Exercises

Update/Create...

  • A text exercise
  • A file upload exercise
  • A modeling exercise

Administrator

Modify...

  • The imprint (go to Server Administration > Imprint)
  • Knowledge areas (click the 👁️ icon to edit) of standardized competencies (Server Administration > Standardized competencies) and standardized competencies

Exam

  • Update/Create an exam
  • Make a live announcement during an exam

Courses and competencies

  • Update a course
  • Update a competency in a course
  • Update a lecture in a course
  • Update a lecture in a course in guided mode
  • Update text unit of a lecture

Special markdown editors

Grading instructions

Prerequisites:

  • 1 Instructor
  1. Create a new exercise (Text is the simplest). At the bottom of the page, add some grading instructions.
  2. Check that the changes are reflected in the markdown (under "Edit as Text")
  3. Check that changes in the markdown are reflected in the "Edit" view.
  4. Save the exercise. Verify that your changes are saved.

Quiz exercises (DnD; MC)

Prerequisites:

  • 1 Instructor
  • 1 Student
  1. As the instructor, create a new quiz. Set the quiz duration to 60-90s for convenience
  2. Add a multiple choice question
  3. Modify the question. Add answer options and add explanations / hints to the answer options. Add a hint or an explanation to an answer option
  4. Try out the visual editor and see that the changes carry over to the markdown text
  5. Add a drag and drop question
  6. Add a background image and text items.
  7. Modify the question's markdown text, e.g. by adding an explanation and changing the hint.
  8. Save the quiz and click "Start quiz"
  9. Participate in the quiz as a student
  10. Check that the questions match your input (explanations are only visible after the quiz & the results are visible)
  11. As the instructor, go back to the quiz and click "Re-evaluate". Check that it displays properly and e.g. set an answer option invalid.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
markdown-editor-monaco.component.ts 94.57%
markdown-editor-parsing.helper.ts 100%
monaco-exercise-reference.action.ts 94.73%
monaco-grading-credits.action.ts 100%
monaco-grading-criterion.action.ts 100%
monaco-grading-description.action.ts 100%
monaco-grading-feedback.action.ts 100%
monaco-grading-instruction.action.ts 100%
monaco-grading-scale.action.ts 100%
monaco-grading-usage-count.action.ts 100%
monaco-editor-action.model.ts 94.38%
monaco-editor-domain-action.model.ts 100%
monaco-formula.action.ts 100%
monaco-task.action.ts 100%
monaco-test-case.action.ts 96%
monaco-correct-multiple-choice-answer.action.ts 100%
monaco-quiz-explanation.action.ts 100%
monaco-quiz-hint.action.ts 100%
monaco-wrong-multiple-choice-answer.action.ts 100%
monaco-editor-option-preset.model.ts 100%
monaco-editor-option.helper.ts 100%
monaco-editor.component.ts 96.15%

Screenshots

Examples below

Standardized competencies

image

Exam live announcements

image

Grading instructions

image

Quiz MC

image

Quiz DND

image

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a new markdown editor component for improved editing experience across various sections of the application.
    • Added initial height configuration for the markdown editor, enhancing user interface adaptability.
  • Bug Fixes

    • Streamlined button enabling logic for better usability.
    • Updated event handling for markdown content changes to ensure accurate state management.
  • Tests

    • Updated unit tests to reflect changes in the markdown editor component and its associated functionalities.

pzdr7 added 30 commits August 11, 2024 12:43
…-editor-grading-instructions.integration.spec.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 20, 2024
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good in general just two small (optional) comments

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range comments (1)
src/main/webapp/app/exercises/shared/structured-grading-criterion/grading-instructions-details/grading-instructions-details.component.ts (1)

Line range hint 136-153: Consider using template literals for string concatenation.

Using template literals can improve readability and maintainability.

- let markdownText = '';
- markdownText =
- MonacoGradingInstructionAction.IDENTIFIER +
- '\n' +
- '\t' +
- this.generateCreditsText(instruction) +
- '\n' +
- '\t' +
- this.generateGradingScaleText(instruction) +
- '\n' +
- '\t' +
- this.generateInstructionDescriptionText(instruction) +
- '\n' +
- '\t' +
- this.generateInstructionFeedback(instruction) +
- '\n' +
- '\t' +
- this.generateUsageCount(instruction) +
- '\n' +
- '\n';
+ let markdownText = `${MonacoGradingInstructionAction.IDENTIFIER}
+ \t${this.generateCreditsText(instruction)}
+ \t${this.generateGradingScaleText(instruction)}
+ \t${this.generateInstructionDescriptionText(instruction)}
+ \t${this.generateInstructionFeedback(instruction)}
+ \t${this.generateUsageCount(instruction)}
+ \n`;

Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, thank you for the quick changes 👍

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code 👍

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested markdown editors in imprint, exam and quiz exercises on TS3

Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested in testing session on ts3, works as expected 👍

Copy link
Contributor

@janthoXO janthoXO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested markdown editors in code of conduct, competencies/prerequesites, Standardized Competency on TS3

@pzdr7 pzdr7 added this to the 7.5.1 milestone Aug 24, 2024
@krusche krusche merged commit 5929e7f into develop Aug 24, 2024
17 of 22 checks passed
@krusche krusche deleted the feature/general/markdown-monaco branch August 24, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready for review tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants