-
Notifications
You must be signed in to change notification settings - Fork 164
fix: contentAnalyzer added to determine TinyMCE Editor type #2609
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
base: master
Are you sure you want to change the base?
fix: contentAnalyzer added to determine TinyMCE Editor type #2609
Conversation
|
Thanks for the pull request, @marslanabdulrauf! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
6975c25 to
2489cc7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2609 +/- ##
========================================
Coverage 94.82% 94.83%
========================================
Files 1226 1232 +6
Lines 27559 27638 +79
Branches 6211 6056 -155
========================================
+ Hits 26133 26210 +77
- Misses 1355 1370 +15
+ Partials 71 58 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I don't quite understand this. When would it not be HTML? And even if it's just a string like "An interesting course." with no HTML, isn't that still HTML in a sense, just without tags? |
| /** | ||
| * Utility functions for detecting content type and | ||
| * determining appropriate editor type for TinyMCE editor | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New files added to this repo should be using TypeScript - please see the "Best practices checklist" in your PR description.
I wasn't sure if I should hard code the editorType as I also agree that |
|
I think it's fine to just hard-code it as HTML, as these are HTML fields. But if you can think of or find any bugs that would result from that, please let me know. |
fb208bb to
c864dea
Compare
|
While testing with the hardcoded If we provide plain text like "hello world", the HTML editor automatically wraps it in a We were trying to avoid this same situation when the overview content is actually HTML, but the editor type is set to If we’re certain that all overviews will be HTML-based, we can safely hardcode |
c864dea to
9436441
Compare
Related Ticket (Internal)
https://github.com/mitodl/hq/issues/9166#event-20756793537
Description
This PR:
Steps to Reproduce
Supporting information
It happens because the default course over is in
htmle.g;<section>About ...</section>and when we serve it as text in TinyMCE Editor it changes the content which triggers the Alert to save the changes.Adding editorType
htmlfixes the issue however as the field is str in edx-platform we might not get html always.So a simple utility function is added to analyze and identify editorType from content.
Testing instructions
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'