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

Replace bootstrap-pagedown and ace markdown editors with ToastUi #2242

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

JuliaCasamitjana
Copy link
Contributor

@JuliaCasamitjana JuliaCasamitjana commented Apr 11, 2024

What does this change?

This PR integrates the ToastUi library and uses it in all forms where markdown editors are required. It replaces the previously used boostrap-pagedown editor (used for exercises, proxy exercises and tips descriptions) and the Ace markdown editor (used in the help field from the execution environment form). It also removes all related code from the dropped editors.

light mode dark mode
Screenshot 2024-04-11 at 13 30 24 Screenshot 2024-04-11 at 13 54 47

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

Current behaviour with such bugs:

editor real output
Screenshot 2024-04-11 at 13 40 13 Screenshot 2024-04-11 at 13 40 46

Decisions / Choices I 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. I 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.

@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch from fd7bc8a to 22b0a1b Compare April 11, 2024 12:33
@JuliaCasamitjana JuliaCasamitjana marked this pull request as ready for review April 11, 2024 12:36
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.30%. Comparing base (96f5f1f) to head (f452e26).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2242      +/-   ##
==========================================
+ Coverage   69.26%   69.30%   +0.04%     
==========================================
  Files         197      197              
  Lines        6228     6230       +2     
==========================================
+ Hits         4314     4318       +4     
+ Misses       1914     1912       -2     

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

Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

Awesome, I am really happy and thankful for the great work you've done here to replace the editor, @JuliaCasamitjana -- I absolutely appreciate it! 👏

Below is a first round of review, mostly focussing on the functionality. Some things might not be that easy and can have a lower priority. Still, some of the errors might be related to our integration and not only focused on bugs in the editor.

Besides that, I also want to take the chance to reply to your decision / comments:

Many thanks again for all the effort you've put into this PR already and the extra mile (I've happily seen the theming support or your changes to the FormBuilder and all those "minor" details that sum up) 👍.

@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch 2 times, most recently from 5af3485 to 94b0773 Compare April 12, 2024 14:27
@JuliaCasamitjana
Copy link
Contributor Author

I've realised there is one functionality we added in Xikolo that I did not include here. It's a custom implementation to expand the editor to fit all contents: https://lab.xikolo.de/xikolo/web/-/merge_requests/4278

Is this something you would also like to have here?

@MrSerth
Copy link
Member

MrSerth commented Apr 14, 2024

I've realised there is one functionality we added in Xikolo that I did not include here. It's a custom implementation to expand the editor to fit all contents: https://lab.xikolo.de/xikolo/web/-/merge_requests/4278

Is this something you would also like to have here?

Ah, that's nice! Yes, if you can easily add it by reusing the existing code, I would be glad to get this custom add-on, too 🙂

Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

I was just testing the new editor again and am really satisfied with the changes and the new look-and-feel it provides 🚀.

@JuliaCasamitjana JuliaCasamitjana self-assigned this Apr 15, 2024
@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch from 94b0773 to 17ebb1d Compare April 15, 2024 14:16
@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch from 3d6263c to c1e755d Compare April 17, 2024 15:08
@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch from c1e755d to e131e81 Compare April 22, 2024 08:47
@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch 2 times, most recently from 4291e45 to b628ab6 Compare April 24, 2024 08:58
Copy link
Member

@MrSerth MrSerth left a comment

Choose a reason for hiding this comment

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

Awesome! 👏 🥳

I've just tested the current changes a final time and am really satisfied with the result. This PR is a major leap forward for CodeOcean, since we are dropping two custom editor solutions and an outdated library. Many thanks for your endurance to tackle all those bugs I've discovered during review and the extra mile you went ahead. There are so many nice additions I see, starting from a solid code base 🏗️ to theme support 🎨.

@MrSerth MrSerth requested a review from Dome-GER April 24, 2024 09:10
MrSerth added a commit that referenced this pull request Apr 24, 2024
MrSerth added a commit that referenced this pull request Apr 24, 2024
Copy link
Member

@Dome-GER Dome-GER left a comment

Choose a reason for hiding this comment

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

Really great job, @JuliaCasamitjana! This is a big achievement. Also, thanks to you @MrSerth for all the support.

Replace all usages of pagedown-bootstrap editor with the new editor.
Add styles to ensure the editor preview matches the final output.
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.
The term 'Pagedown' was originally associated with the pagedown-bootstrap
library, which is no longer in use.
Drop unused code related to the Ace markdown editor.
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.
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.
@JuliaCasamitjana JuliaCasamitjana force-pushed the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch from b628ab6 to f452e26 Compare April 26, 2024 10:18
@Dome-GER Dome-GER merged commit da9add4 into master Apr 26, 2024
10 checks passed
@Dome-GER Dome-GER deleted the jc/XI-6295_codeocean_replace_pagedown_with_toatsui branch April 26, 2024 11:31
MrSerth added a commit that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants