HTML editor 2.0
This page details the specification of the HTML editor in Moodle 2.0.
What we want
Ticket MDL-11113 discusses most issues.
- Integration - With Moodle (smileys, different formats, etc.) with a minimum of changes, cleaning up current code as much as possible
- Compatibility - With web browsers (mostly FF, IE, Safari, Opera)
- Standard - Outputs valid XHTML code
- Accessibility - Is it 100% keyboard accessible? Is it usable in JAWS? Etc.
- Configurability - Possibility to make it show different options and buttons according to the user, the context, etc.
- Support - Developed by an active community that will support it for a long time.
Some features that should be evaluated:
- Handling of Word documents
- HTML code direct editing
- Highlighting (not text background color, with "set-on" operation--Word style)
- Image uploading
- Mathematical formulas/equation editing
- Possible to turn it on and off on demand (on the page) without losing (possibly modified) content (see this TinyMCE example of this)
- Right-to-left text input
- Smileys (has to be possible to use the Moodle list of smileys)
- Special characters
- Themeable (possible to make a theme that fits with Moodle's)
- Make it possible to change to a different editor (provided someone comes up with the necessary code to "plug it" in Moodle)
- Possible to run many instances on the same page (see MDL-11101 in tracker)
- Fix all the bugs related to the HTML editor
- Submit drafts in the background, using ajax.
Possibilities and evaluation
- Comparison of WYSIWYG HTML editors on Wikipedia
- TinyMCE: Compatibility, Documentation, Demo
- FCKeditor: Compatibility Documentation, Demo
- Xinha: Documentation, Demo
- Yahoo RTE: Documentation, Demo,
As of 16 April 2008, the preference goes to TinyMCE.
Plan of action
- Get latest TinyMCE in HEAD before 13 May 2008 so that work can be done there (done, MDL-14739)
- Have the XHTML profile active by default in TinyMCE (done)
- Attack each Moodle plugin in turn, keeping modifications to TinyMCE code base as modular and minimal as possible
Plugins to write
Some plugins will have to be written for each editor to make integration with Moodle possible. These should be as abstracted as possible, to make as much code as possible common between each. Since editors will be located under /lib/editor, let's store this common code under /lib/editormod.
- File browser: the file browser (especially with the File API) will be Moodle specific
- Emoticons (smileys): Moodle defines its own list of emoticons, we need to make sure the editors use these consistently
- Language files: Moodle has a lot more languages than any editors, and some strings will be Moodle-specific. We need a way to make for each editor to use Moodle strings, reusing as many existing strings as possible, and using lang/xx/editor.php for the rest.
- Equation editor: there is ongoing work to get Dragmath working in Moodle, making a common plugin could be a nice improvement
- Multilang: all editors need to support multilang properly.
It also may be possible to use Moodle's CSS files to define editors themes/skins, this needs investigation
- TinyMCE makes it possible to have self-registering plugins, that don't need to be under it's /plugins folder (and so could be in a moodle-specific folder).
- FCKeditor needs to have its plugins in a specific place.
Change in formats
There is a bug (MDL-4868) about Markdown not being converted to HTML when using the HTML editor (after creating a post with Markdown).
This really applies to all non-HTML formats.
Proposal: whenever the HTML editor is used to edit existing non-HTML text, we convert the text to HTML for use in the editor. Saving the changes will save the text (and format) as HTML.
Although we are losing some information, we feel it's an acceptable tradeoff against overall usability, particularly as the HTML editor works on a wider range of browsers and we make XHTML compliance a requirement.
Links to forum discussions, tracker, docs, etc.
- [https://tracker.moodle.org/browse/MDL-11113 MDL-11113 - Get a fully working HTML editor in Moodle]
- Moodle-specific customisations to the HTML editor
Using Moodle General developer forum discussions: