-
Notifications
You must be signed in to change notification settings - Fork 20
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 django-ckeditor with django-tinymce #2324
base: dev
Are you sure you want to change the base?
Conversation
This breaks badly in old browsers: using Firefox 78, the editor mostly seems to work, but upon trying to save the form it crashes (which the user won't notice unless they are watching the console) and apparently submits blank content. tinymce/tinymce#9557 |
Can we raise a warning for people with old browsers or would you prefer to explore alternatives? From googling, the latest version of CKEditor is popular (though I'm sure it has its own issues). |
I'm certainly willing to look at alternatives & that's part of why I wanted to post this as a preview. But it also should be possible to add a workaround (my thought was to fall back to a plain textarea on old unsupported browsers.) |
Personally I'd rather just ask people using outdated browsers to update them! |
I have had a quick play around with this. It seems to work, so I'm not against switching to TinyMCE. My main thoughts are: 1. AutosaveWe appear to have lost the "auto-save" feature, which I think is fairly important for preventing people losing their work (e.g. when they accidentally go back on the browser or click on a tab withoutsaving). 2. StyleThe new editor is slightly less visually appealing (for me, at least). It feels busy. Compare CKEditor: Vs TinyMCE: |
Thanks!
Certainly a valid concern. Worth checking out the official autosave plugin: https://www.tiny.cloud/docs/tinymce/latest/autosave/ (CKE5 has an autosave plugin too; like all CKE5 plugins, it requires recompiling the editor)
You have a point. I think the cluttered feeling may be due in part to the autoresize behavior, which initially I thought was cool but now I'm less sure about. Try turning that off - comment out "autoresize" from the list of plugins, and compare. If there are specific things you'd like to tweak, it shouldn't be hard to add a little custom CSS here and there. |
This doesn't give the same UX as the autosave plugin we have been using, but I think it should be sufficient. It does two things:
Keep in mind that this plugin won't import autosave data from the CKE4 autosave plugin. |
Much like the pnmathml plugin did for CKE4, this plugin enables editing MathML elements using LaTeX syntax (which is parsed and converted to MathML using MathJax 3.)
This plugin adds a button and a keyboard shortcut for applying <code> style tags to text.
Ugh, modal boxes (source code, equation editor) are not working now. There's some bad interaction with other site scripts, probably bootstrap stuff. (TinyMCE works correctly inside Django admin.) Something was already screwy before this - with CKE4, if CKE4 tries to "pop up" a modal box, then the page "underneath" the modal box scrolls back to the top, which is annoying. But now (after I added |
this:
|
Use the same backdrop color/opacity as Bootstrap modal dialogs.
As we've discussed, PhysioNet's current rich text editor (CKEditor 4) is unmaintained and should be replaced. This branch replaces
django-ckeditor
withdjango-tinymce
(https://github.com/jazzband/django-tinymce).The user interface of TinyMCE is not too different from CKEditor 4. I've taken this opportunity, though, to try to tweak things to better serve PhysioNet's use cases. Notable changes include:
A toolbar button for adding
<code>
tags (also accessible via Ctrl+D.)No toolbar buttons for
<u>
,<blockquote>
, or<pre>
tags (these styles are still accessible via the drop-down style menu.)No toolbar buttons for adding/removing links (links can still be added using Ctrl+K.)
You can add italics, bold, code, equations, lists, and section headers using markdown-like syntax (
*italics*
becomes<em>italics</em>
, etc.)You'll see a warning if you try to navigate away or close the window without saving your changes. Also, content is auto-saved in local storage and can be restored by clicking the "Restore last draft" button at the end of the toolbar. Note that this does not import any auto-saved content from CKEditor.