-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[BB-6151] feat: upgrades tinyMCE v4.0.20 to tinyMCE v5.5.1 #30335
[BB-6151] feat: upgrades tinyMCE v4.0.20 to tinyMCE v5.5.1 #30335
Conversation
Thanks for the pull request, @DubeySandeep! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
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.
(Leaving some inline comments to explain the changes to reviewer.)
codemirror: { | ||
path: baseUrl + "js/vendor" | ||
path: baseUrl + "js/vendor", | ||
disableFilesMerge: true, |
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.
The new codemirror plugin allows passing the custom jsFiles to the plugin. Earlier we had to change the plugin code (ref)
theme: "modern", | ||
skin: 'studio-tmce4', | ||
theme: "silver", | ||
skin: "studio-tmce5", |
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.
"studio-tmce5" is the new skin created having similar colour and style of "studio-tmce4" (Note: The custom-skin structure is completely changed in v5 so we had to regenerate the new skin from scratch.)
"alignleft aligncenter alignright alignjustify | " + | ||
"bullist numlist outdent indent blockquote | link unlink " + | ||
((this.new_image_modal ? 'insertImage' : 'image') + " | code"), | ||
toolbar: "formatselect fontselect bold italic underline forecolor wrapAsCode " + |
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.
Although we have used |
here but we had disabled the "bars" in the studio-tmce4 skin but disabling the "bars" is not possible in the new skin so ended up remving "|" to achieve the old UI.
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.
It's also worth noting that these separators are redundant now. The only thing they were doing before, was wrapping the toolbar items in groups. I.e. if a button from a single group should be moved to a lower row (due to insufficient width of the editor), then the whole group is moved there instead.
It is no longer the case because the default toolbar modes have been changed to more user-friendly options. The PC version is using the floating toolbar, but for this to happen, a browser's window width would need to be under 1024px. On mobile devices, the overflow is handled by scrolling.
image: baseUrl + "images/ico-tinymce-code.png", | ||
onclick: function() { | ||
tooltip: gettext('Code block'), | ||
icon: 'code-sample', |
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.
TinyMCE5 only allows svg icons and have different way to add new icon (ref), overe here we are using a builtin icon.
Old png icon: { }
New svg icon (code-sample): { ; }
(Check screenshot in the PR description for UI)
@DubeySandeep Thank you for your contribution. Is this ready for our review? |
@jmbowman @jristau1984 as this change affects Studio as opposed to the LMS, maybe it should be reviewed by TNL? |
1d4dff0
to
9201eb2
Compare
@natabene Thanks for checking! Yeah, the PR is ready for review, I've asked @Agrendalath to take the first pass (as an internal reviewer) and I'll be happy to get feedback/suggestion from other reviewers! :) |
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.
@DubeySandeep, I've tested that this is working correctly with both announcements and HTML XBlock. I've checked the HTML XBlock in the Studio unit view, the custom pages view, and the bulk email section of the Instructor Dashboard.
Could you please look into this failing JS test?
"alignleft aligncenter alignright alignjustify | " + | ||
"bullist numlist outdent indent blockquote | link unlink " + | ||
((this.new_image_modal ? 'insertImage' : 'image') + " | code"), | ||
toolbar: "formatselect fontselect bold italic underline forecolor wrapAsCode " + |
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.
It's also worth noting that these separators are redundant now. The only thing they were doing before, was wrapping the toolbar items in groups. I.e. if a button from a single group should be moved to a lower row (due to insufficient width of the editor), then the whole group is moved there instead.
It is no longer the case because the default toolbar modes have been changed to more user-friendly options. The PC version is using the floating toolbar, but for this to happen, a browser's window width would need to be under 1024px. On mobile devices, the overflow is handled by scrolling.
4. Find all the EDX specific changes in the currently used version of tinymce by searching for the string "EDX" in the vendor/js/tinymce dir. | ||
5. Merge the EDX specific changes with the newly downloaded version. |
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.
Just for better visibility during the review. We have only two overrides - one in plugins/codemirror/source.html
and one in js/tinymce/plugins/codemirror/plugin.js
. Is it correct?
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.
2. Open terminal and change directory to the newly downloaded tinymce. | ||
3. Run the build command: “yarn build”, this will create multiple zip files in the build directory. | ||
4. Unzip the tinymce_<version>.zip file in common/static/vendor/js/ | ||
5. Unzip vendor_extra/tinymce/JakePackage.zip in common/static/vendor/js/tinymce/. |
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.
I believe it's common/static/js/vendor/tinymce/
,
Also, is there a specific reason to use js/vendor/tinymce/js/tinymce
instead of just js/vendor/tinymce
?
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.
Also, is there a specific reason to use js/vendor/tinymce/js/tinymce instead of just js/vendor/tinymce?
the common/static/js/vendor/
is the open-edx structure for storing vendor files where as js/tinymce/
is the tinymce's structure (the js dir contains other files like README, packge.json etc.).
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.
I believe it's common/static/js/vendor/tinymce/,
Yeah, that's true! I've updated the instructions.
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.
where as js/tinymce/ is the tinymce's structure
I couldn't find any references to this structure in TinyMCE or CodeMirror, but I see that it's referenced like this in multiple places within the edx-platform, so let's keep it as-is for backward compatibility.
(the js dir contains other files like README, packge.json etc.).
I don't see other files in vendor/tinymce/js, but I suppose that keeping BUILD_README.txt in a separate directory increases its visibility 👍
Owning team will want to have a look at this before merging, since they are actively working in this area. |
@Agrendalath This was a doozy. I finally traced it to a race condition in the tests where data was being queried before TinyMCE has finished initializing. I have update the tests, to wait until init is complete before testing. Kindly review. |
@@ -1406,7 +1410,7 @@ | |||
if (this.editor_choice === 'visual') { | |||
visualEditor = this.getVisualEditor(); | |||
raw_content = visualEditor.getContent({ | |||
format: "raw", | |||
format: "text", |
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.
TinyMCE 5 uses the value text
instead of raw
for the format
.
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.
👍
- I tested this: checked that it is working correctly with both announcements and HTML XBlock; checked the HTML XBlock in the Studio unit view, the custom pages view, and the bulk email section of the Instructor Dashboard.
- I read through the code
- I checked for accessibility issues
- Includes documentation
- I made sure any change in configuration variables is reflected in the corresponding client's
configuration-secure
repository: n/a
@natabene, this is ready for your review. |
be6d7df
to
c54a007
Compare
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.
We found some regressions that cannot be reproduced locally. I'm converting it to a draft for now.
@Agrendalath I have added the commit 49e3309 with the fix for editor breaking on Studio. The minified version of the TinyMCE doesn't seem to play well with the optimized builds of webpack. Once I switched out the minified to a non-minified version in the Webpack configuration and redid a optimized build, things started to work fine. Another side-effect I noticed is that the size of the Before - using tinymce.full.min.js - 2.2MBAfter - using the tinymce.js - 1.4MB |
49e3309
to
ada8e9f
Compare
@Agrendalath Please let me know if this is ready. |
@tecoholic, I deployed this to the production-like environment (which is using a CDN) and noticed that we have missed the following change: 9c1a42b. We need to check if there is something else missing from here: #3155. |
@Agrendalath I have made the necessary changes to get the iframe communication working in TinyMCE in 1ed35b7. But I am afraid the work is far from being done.
Let's move this to draft until we wrap all of this up. |
a11b3e1
to
8d49e28
Compare
* This commit updates the instructions for updating TinyMCE with working set of steps as the previous instructions using the Jakefile was outdated. * The Jakefile zip bundle in vendor_extras is removed as it is no longer required
82a5cb3
to
6b976bf
Compare
@Agrendalath Rebased on master and resolved conflicts. |
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.
All good from my end. Linking my review: #30335 (review)
@DubeySandeep 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
…rsion 5.x (openedx#1869) * feat: replace references to tinymce v4 with v5 Replaces the version 4.x references of TinyMCE static files with version 5.x and removes the workaround required for TMCE 4 from oa_editor_tinymce.js Related platform PR: openedx/edx-platform#30335 Related changes: * fix: set tinymce base url so resources are loaded in studio * fix: theme files not loading on studio edit window * chore: bumped minor version to 4.5.0 * chore: update edx paragon to latest version, and fix failing tests due to paragon api change * fix: fix and update translations Co-authored-by: Agrendalath <piotr@surowiec.it> (cherry picked from commit 6072196)
Co-authored-by: Arunmozhi <arunmozhi@opencraft.com> (cherry picked from commit 51b5e62)
Co-authored-by: Arunmozhi <arunmozhi@opencraft.com> (cherry picked from commit 51b5e62)
Recent upstream changes to Olive include deletion of the "modern" theme we've used for the TinyMCE initialization for the course overview field in the Studio course Schedule and Details page. The fix: use the "silver" theme added in the same PR the "modern" theme was removed. Check [this PR](openedx#30335) for details. YT: https://youtrack.raccoongang.com/issue/RGOeX-25023
Recent upstream changes to Olive include deletion of the "modern" theme we've used for the TinyMCE initialization for the course overview field in the Studio course Schedule and Details page. The fix: use the "silver" theme added in the same PR the "modern" theme was removed. Check [this PR](openedx#30335) for details. YT: https://youtrack.raccoongang.com/issue/RGOeX-25023
Description
This PR upgrades TinyMCE version 4 to version 5.5.1.
These changes will impact the "Course author".
Supporting information
Testing instructions
Testing new TinyMCE in Studio
Ensure the “visual” and “raw” html editor are working fine
Ensure the “codemirror-plugin” works fine in the tinymce editor
Testing announcements message in studio
Screenshots and videos of UI changes
Video comparing TinyMCE4 and TinyMCE5 in studio
TinyMCE4_vs_TinyMCE5.mp4
OLD TinyMCE UI in Studio
NEW TinyMCE UI in Studio
OLD TinyMCE UI on announcement editor page
NEW TinyMCE UI on announcement editor page