[Refactor:TAGrading] Move markdownarea to vue#11872
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11872 +/- ##
============================================
- Coverage 20.60% 20.58% -0.02%
+ Complexity 9279 9278 -1
============================================
Files 267 268 +1
Lines 35519 35539 +20
Branches 455 457 +2
============================================
Hits 7317 7317
- Misses 27751 27769 +18
- Partials 451 453 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
williamschen23
left a comment
There was a problem hiding this comment.
https://github.com/user-attachments/assets/945f604c-b403-4004-8eed-675da9f4b801
Markdown options only available on refresh
| success: function (res: string) { | ||
| const response = JSON.parse(res) as SolutionTaNotesResponse; | ||
| if (response.status === 'success') { | ||
| displaySuccessMessage('Solution has been updated successfully'); | ||
| // Dom manipulation after the Updating/adding the solution note | ||
| $(`#solution-box-${component_id}`).attr('data-first-edit', 0); | ||
| $(`#solution-box-${component_id}`).attr('data-first-edit', '0'); | ||
|
|
||
| // Updating the last edit info | ||
| $(`#solution-box-${component_id} .last-edit`).removeClass('hide'); | ||
| $(`#solution-box-${component_id} .last-edit i.last-edit-time`).text(res.data.edited_at); | ||
| $(`#solution-box-${component_id} .last-edit i.last-edit-time`).text(response.data.edited_at); | ||
| $(`#solution-box-${component_id} .last-edit i.last-edit-author`).text( | ||
| res.data.current_user_id === res.data.author ? `${res.data.author} (You)` : res.data.author, | ||
| response.data.current_user_id === response.data.author ? `${response.data.author} (You)` : response.data.author, | ||
| ); | ||
|
|
||
| $(`#solution-box-${component_id}`).find('.solution-cont') | ||
| .attr('data-original-solution', $(`#textbox-solution-${component_id}`).val()); | ||
| .attr('data-original-solution', ($(`#textbox-solution-${component_id}`).val() as string ?? '')); | ||
|
|
||
| const save_button = $(`#solution-box-${component_id}`).find('.solution-save-btn'); | ||
| save_button.prop('disabled', true); |
There was a problem hiding this comment.
can we avoid jquery here?
williamschen23
left a comment
There was a problem hiding this comment.
Functionality reviews:
When clicking "preview", the insert markdown buttons don't disappear
When refreshing the forums, the toggle button does not stick
williamschen23
left a comment
There was a problem hiding this comment.
https://github.com/user-attachments/assets/774ecf90-12d1-4317-be12-c14545b5cd3
I think this is the last thing, I don't have any problems with the code.
The forum new thread markdown renders weirdly
williamschen23
left a comment
There was a problem hiding this comment.
Every markdown box that changes in the PR works. The way the the markdown box is rendered in the code is pretty clear. The v-html is safe as it comes from twig, which automatically escapes dangerous elements
### Why is this Change Important & Necessary? <!-- Include any GitHub issue that is fixed/closed using "Fixes #<number>" or "Closes #<number>" syntax. Alternately write "Partially addresses #<number>" or "Related to #<number>" as appropriate. --> This moves the first tagrading panel to vue. ### What is the New Behavior? <!-- Include before & after screenshots/videos if the user interface has changed. --> Solution notes is rendered with vue and the twig + separate scripts are removed. ### What steps should a reviewer take to reproduce or test the bug or new feature? ### Automated Testing & Documentation <!-- Is this feature sufficiently tested by unit tests and end-to-end tests? If this PR does not add/update the necessary automated tests, write a new GitHub issue and link it below. Is this feature sufficiently documented on submitty.org? Link related PRs or new GitHub issue to update documentation. --> ### Other information <!-- Is this a breaking change? Does this PR include migrations to update existing installations? Are there security concerns with this PR? --> This is meant to be merged after #11872
### Why is this Change Important & Necessary? Resolves #12068 Markdown toggle on Forum replies does not function correctly (see issue for more details). Also, toggling markdown may erase the contents of the text box in certain cases. Bug introduced by Vue refactor #11872 where markdown toggle logic is moved to cookie ### What is the New Behavior? Vue component has been updated to directly read+write to original HTML form input, removed unnecessary cookie Markdown fields without toggle functionality are preserved It is worth investigating to find a better solution for propagating Vue state updates to outer DOM in the future.
Why is this Change Important & Necessary?
Currently markdownarea uses twig and therefore when it has to be rendered client-side for tagrading it uses twigjs which makes moving any code that interacts with it to vue far more difficult.
What is the New Behavior?
Markdownarea is moved to vuejs
What steps should a reviewer take to reproduce or test the bug or new feature?
Automated Testing & Documentation
Other information