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

Add ToastUi editor for markdown elements #1368

Merged
merged 5 commits into from
Apr 26, 2024
Merged

Add ToastUi editor for markdown elements #1368

merged 5 commits into from
Apr 26, 2024

Conversation

MrSerth
Copy link
Member

@MrSerth MrSerth commented Apr 24, 2024

What does this change?

This PR integrates the ToastUi library and uses it in all forms where markdown editors are required (task descriptions and collection descriptions). Hence, this PR relates to #1114 and improves the editor experience for those attributes currently relying on Markdown. All code changes are based on the great work done by @JuliaCasamitjana with openHPI/codeocean#2242.

light mode
Bildschirmfoto 2024-04-24 um 10 20 28

Note: There are three open bugs affecting the ToastUI preview:

Current behaviour with such bugs:

editor real output
321616362-3ac4bc6f-d22d-4209-8b83-df3b34e1e598 Bildschirmfoto 2024-04-24 um 10 24 49

Decisions / Choices we made

  • In Xikolo we solve the issues caused by these bugs by dynamically parsing the user content using a different parser (markdown-it) and replacing the contents of the toastUi preview accordingly on the fly. We did not include this workaround, but implementing a similar solution here wouldn't require significant additional effort if we prefer to adopt this somewhat hacky approach.
  • While integrating ToastUi in CodeOcean, we found some severe bug affecting the input of codeblocks with ```. The last commit ef77c47 implements a workaround for this bug.

@MrSerth MrSerth added enhancement ruby Pull requests that update Ruby code javascript Pull requests that update Javascript code labels Apr 24, 2024
@MrSerth MrSerth self-assigned this Apr 24, 2024
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.26%. Comparing base (f36104a) to head (a882e40).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1368      +/-   ##
==========================================
+ Coverage   92.19%   92.26%   +0.06%     
==========================================
  Files         101      102       +1     
  Lines        2397     2418      +21     
==========================================
+ Hits         2210     2231      +21     
  Misses        187      187              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

MrSerth and others added 5 commits April 26, 2024 12:49
Add styles to ensure the editor preview matches the final output.

Co-authored-by: Julia Casamitjana <[email protected]>
The default ToastUI image insertion feature includes both URL and file
upload options. However, file upload functionality isn't supported in
the application. This commit addresses the issue by implementing custom
code to hide the file upload button while preserving the URL insertion
option.

Co-authored-by: Julia Casamitjana <[email protected]>
The editor will now have a default height of 300px but a button will let
the user expand the editor. It will expand it to fit all content (or up
to 400px if the content was not exceeding 300px). In the expanded mode
the editor will keep growing as the user types more content.

Co-authored-by: Julia Casamitjana <[email protected]>
Manually inserting a codeblock adding three backticks and hitting enter
is not functioning in the ToastUI editor due to an existing bug in the library.
This commit implements a workaround to address the issue.

Co-authored-by: Julia Casamitjana <[email protected]>
Copy link
Contributor

@JuliaCasamitjana JuliaCasamitjana left a comment

Choose a reason for hiding this comment

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

Everything looks good to me! Thank you also for your kind words of appreciation! 😊

@Dome-GER Dome-GER merged commit 522dd55 into master Apr 26, 2024
13 checks passed
@Dome-GER Dome-GER deleted the toast_ui branch April 26, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement javascript Pull requests that update Javascript code ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants