-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Upgrade TinyMCE and switch to CodeMirror plugin #2657
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
Conversation
|
Hi @cahrens i check the migration guide from tinymce site[1] and the directory name must changed: [1] http://www.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x |
|
@ovnicraft I think the directory name where the vendor source is placed can be anything (as long as path references are correct). I'm not seeing any issues with it still being tiny_mce. |
|
LGTM, i was working with this to set overview course in CMS with tinymce by default, so i will wait to this PR merged. |
|
@ovnicraft We are interested in having all of the places where raw HTML is exposed use a TinyMCE/Codemirror combo similar to what we use for the HTML xmodule (on unit page). The thought was to have a reusable Backbone View that could be used throughout the product (and would also be used in HTML's edit.coffee file). |
|
@talbs @frrrances @marcotuts Here is the PR with the TinyMCE upgrade. Sorry to tag you all, but I'm not sure who will pick up the work. I have restored all the toolbar items we previously had, although I had put them on 2 lines just to make them all visible. Here is a link to a description of what changed regarding themes: Note that in addition to the usages in Studio (HTML Editing component on unit page, static tabs), the LMS instructor dashboard uses TinyMCE (via the html xmodule) for bulk e-mail. And there are 2 versions of the instructor dashboard-- the legacy one and the beta one. To get to instructor dashboard, go to LMS logged in as an instructor in the course (can set "Admin" status in Studio via course team settings). Then go to Instructor tab and look for "email". In this usage, CodeMirror should appear tabbed with TinyMCE as it does in the other locations-- however, currently I am not seeing the TinyMCE editor, even though it is loading correctly. |
|
@cahrens sounds good, BTW i dont know what Codemirror does, i will wokr in some PR in this week in mention you to review. :-) |
|
@frrrances I did a little debugging of the issue of CodeMirror not appearing for the instructor dashboard bulk email feature. I think the issue is that annotations CSS is setting the z-order for tinymce to something incredibly high, and it is impacting the CSS here as well. Annotations checked in their own version of tinymce (more recent that what we have checked in to master), so I think the problem didn't manifest until the upgrade because the CSS classes are different in the more recent versions of tinymce. |
|
@cahrens the work I'm doing to replace CodeMirror would require TinyMCE v4 as a pre-req. Do you have a timeframe for this PR being merged? |
|
@frrrances Should we delete the directory common/static/js/vendor/tiny_mce/skins/studio from the PR? |
|
@cahrens Yes, that makes sense to me if we're upgrading all instances. |
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.
Here is not tinymce,min.js ?
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 don't understand your question, Cristian.
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.
Why you point to tiny_mce.min.js ? is not tinymce.min.js ?
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.
Got it-- I'll take a look. Thanks.
|
@cahrens its work here ! |
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.
@frrrances Should we get rid of this div (also in LMS template at the end)?
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.
Since TinyMCE inserts a bunch of stuff after the textarea below, I would like to keep this wrapper div in case we want to contain all of it. Thanks for asking though!
|
@waheedahmed This PR deletes the code you just added in #2967. However, I think it should be fine because we are no longer doing the tabbed HTML/Code editor approach. Can you try it out and check? Note that to bring up the HTML editor, you now press the last toolbar button ("Source code"). |
|
this looks great from a CSS and interaction standpoint. nice work! 👍 |
|
@andy-armstrong @nasthagiri And here is the diff for lms/templates/widgets/html-edit.html: |
|
@lduarte1991 This is the PR to upgrade TinyMCE. I did some smoke testing to make sure that this new version doesn't somehow break your different version of TinyMCE (within the LMS), but you might also want to do some testing. I have deployed the branch to http://studio.cahrens.m.sandbox.edx.org/. The username/password to access the site is the same as what we use for staging (send me an e-mail if you don't remember it). |
|
A couple of issues: I believe, in the image plugin popup, the Image Description field needs to have id and name of "alt" for accessibility. After adding an image with url /static/.... the code plugin no longer pops up a window and I get a 404 to the static image in the console. |
|
@dcadams The plugin popup is being rendered by TinyMCE's Plugin Manager. So there probably are accessibility issues, but it's not something we have much control over. Unless there is some sort of accessibility patch for TinyMCE. @davestgermain, can you do an accessibility pass on this version of TinyMCE? As far as the code plugin not opening, I have noticed that sometimes the plugin window does not reopen until I click in the TinyMCE Editor and then click again on the toolbar icon. I don't think it is related to what is in the Editor. Can you try the workaround and see if it causes the editor to reopen for you? The 404 is expected, as the image really doesn't exist with the /static/ path. We got those 404 errors before as well (in master). For example, GET https://studio.edge.edx.org/static/grinning.jpg 404 (Not Found) tiny_mce.js:1 Thanks for trying it out! Let me know if you see other things. |
|
@cahrens As of now the version on the live site and the one you deployed don't have Annotator running in the studio so I can't confirm whether it works or not but we can tackle it in our end after you've deployed it. It shouldn't interfere with the LMS version because we are using our own version of tinymce at the moment. |
|
@lduarte1991 Yes, I was talking about testing the LMS version, not the CMS. I just wanted to make sure there were no conflicts over CSS or global variables between your version of TinyMCE and ours. This upgrade changes the version we use for both LMS and CMS (though I think the only LMS usage is in the Instructor dashboard). |
|
@cahrens Just tested. No issues that I could tell. |
|
@cahrens After adding an image the image icon remains highlighted and it seems that all of the plugins become non-operational; although the drop-downs still drop down. I tried clicking everywhere but it doesn't change the state of the thing. |
|
@dcadams I sent you some comments in HipChat. The image icon will be highlighted as long as the image is selected in the TinyMCE Editor (like how the link icon works). But I can't reproduce the plugins not becoming operational. Can you work out the reproduction steps (does it happen for you every time)? Is this on my sandbox, or did you pull the branch? Any debugging you can do of what is happening would be very helpful, as I can't reproduce the issue myself. |
|
👍 Looks great, and the tests are fantastic. Thanks for addressing our in person review comments. My only additional comments are regarding the UX of the CodeMirror modal. @frrrances, I know you tweaked it some and so these may not be possible, but I figure I'll write down my thoughts just in case:
|
This allows us to convert the static links.
|
@nasthagiri @andy-armstrong @marcotuts @dcadams @mhoeber OK, I have responded to a bunch of feedback and updated the sandbox (http://studio.cahrens.m.sandbox.edx.org/). Please look over the additional commits and try it out! These are the changes of note:
|
|
👍 Looks great, thanks. |
|
Frances is considering changing the icons for "Code block" and "Edit HTML". Otherwise, I think this PR is ready to go. If you disagree, let me know! |
|
@nasthagiri @andy-armstrong @marcotuts @dcadams @mhoeber Icons have been updated, and there are some small styling changes. As far as I know, there are no outstanding issues. |
|
The "Insert/Edit Image" icon asks for "Source". What can this "Source" be? So can we rename "Source" back to "Image URL" or something that is more informative? Otherwise, it was unclear to me what was exactly required. And I was surprised when it didn't work with my local file. |
|
One minor comment -- in new insert image dialog, advanced tab: the style field is editable, but gets populated with other settings (border, etc). I would make Style field read only. |
Code editor button no longer shows an icon, and code style toolbar button location has moved.
|
@nasthagiri I fixed the typos (your comments did not disappear because they are on a particular commit). @nasthagiri and @mhoeber I would like to minimize the changes we make to the 3rd party plugins. We had to make a lot to the code editor plugin, but they were unavoidable. For the image plugin, I don't really want to start changing the code and styles. Filing enhancement requests to TinyMCE (this is one of their own plugins, I believe) seems like the way to go. But I will run this by Lou and @frrrances as well. |
|
👍 Pending the resolution around the wording of "Source" in the image plugin. From my perspective, it would be clearer to users (especially non-HTML users) if it explicitly said "Image URL" (like it did before). |
|
👍 Thanks for all the attention to detail @cahrens and @frrrances. I really like the way this came out. Changing the button label to be "HTML" instead of an icon resolves all my concerns about the discoverability of the feature while also reducing the confusion with the code block button. |
Upgrade TinyMCE and switch to CodeMirror plugin
|
@ovnicraft As an FYI, @dcadams will be working on hooking up TinyMCE to the places in Studio where we currently show the "raw HTML Editor". I know you also expressed an interest in this, and I'd like to avoid duplicated work. |
|
@dcadams please tag me on any JIRA issues and PRs related to this. |
|
FYI - @dcadams is out of town and offline this week. On Mon, Mar 24, 2014 at 11:40 AM, Cristian Salamea <notifications@github.com
|
|
Here is the change log for TinyMCE. We'll give the latest version (4.0.20) a try. |


High Level Description: new version of TinyMCE and change to get rid of the tabbed TinyMCE/CodeMirror editors in favor of a CodeMirror plugin within TinyMCE (triggered from toolbar).
Details:
Unfortunately, I had to edit the code of the CodeMirror plugin and the code for the link and image plugins for the following reasons:
CodeMirror plugin for TinyMCE
Image and Link plugins
Currently no events are fired when a Plugin is triggered or when it goes away. I have submitted a feature request to TinyMCE for this. http://www.tinymce.com/develop/bugtracker_view.php?id=6799
I also posted a comment on the web page for the CodeMirror plugin about the bug related to the caret positional span.
Places to test:
New test coverage added (integration):
I have deployed this branch to http://studio.cahrens.m.sandbox.edx.org/
Code reviewers-- you may now start your engines.