Moodle-specific customisations to the HTML editor

From MoodleDocs

In this forum thread I summarise the position we have got ourselves into with the HTML editor. Moodle uses a WYSYG HTML editor called HTML area, which is now discontinued. We really want to switch to one of three other choices, but before we can do so, we need to work out exactly which Moodle-specific customisations we have made to HTML area to integrate it with Moodle, so we can make the same customisations to whichever editor we adopt in its place.--Tim Hunt 12:57, 29 July 2007 (CDT)

Summary of the customisations we already know about

1. Image browsing: Integrate the add image dialog with the Moodle course files area.
2. Multi-language support: Integration with Moodle's internationalization system, instead of HTMLarea's one. Done via lang/en.php.
3. Roles: Changes to integrate with roles and capabilities.
4. Accessibility fixes: Accessibility changes in Moodle 1.8, including making the editor code XHTML strict.
5. Bug fixes.
6. Usability. Should use the same processes like moodle uses at other places. 
7. Extra features
8. Multiple browser support 
9. File browsing: Related with item 1, but generic browses generically, not just for images.
10. Character popups.
11. Moodle smileys,
12. Flexible buttonsets


Hopefully any replacement editor we choose will follow accessibility best-practice and have known bugs fixed, 4) and 5) should not be required when integrating a new editor. However, we should audit the code of any new editor to make sure it is XHTML strict.

1) and 9) are the only potentially difficult ones.

2) Will have to be redone, but is pretty trivial. (but not completed in existing editor (3thrd row of menu is not translatable)

3) we should be able to find all the ways capabilities are used in the current editor by searching for the has_capability calls.

6) Today the logic of file management in HTML editor is an other one than at the Moodle file manager (i.e. Editor: choose file by click on the file name, File management: choose file by click on action). If it is not possible we have to think about the process in Moodle file manager.

7) It include: Tables management, Smilies (emoticons), Special Characters, Handling of MSWord Formats (and/or cleaning it), Switching to HTML-Code, Right to left text formats, Search and replace, Undo, Redo

8) It means: Firefox 1.5+, IE6+, Opera9+ and Safari.

Four possible replacements

All four of these are widely used by other open source projects, are under active development, with a release since May 2007.

Of these, only TinyMCE and YUI-RTE currently claims to support Safari, although FCK is aiming at it, and give a good justification why it is not there yet:


LGPL licensed.

1. DONE: Former work was done to integrate moodle and tinyMCE (lib/editorlib.php).
2. ToDo: Seams easy, as far as tinyMCE takes it in consideration.
3. ToDo: Seams easy, if we define clearly what capabilities do we need and if editorProfileByRole is developed in moodle's core.
4. DONE: Tiny is XHTML strict.
5. DONE: Tiny developers take care of bug fixes. Safari support was a lack but it's improved in last releases.
6. ToDo: (I'm uncertain about this...)
7. DONE: All extra features are included in this editor, and if it's needed could be extended with new plugins.
8. Part:
         Safari compatibility through a installing Webkit (experimental)


Approximately BSD licensed.

When HTMLarea was discontinued, this project was set up to continue development.


GPL, LGPL or MPL tri-licence.

Stephen Sandhu is successfully integrating FCK with Moodle. (

1. DONE: Work done to integrate FCKeditor into weblib.php (print_textarea) into all textareas
2. ToDo: Changing editor functionality by role.
3. ToDo: Seams easy, if we define clearly what capabilities do we need and if editorProfileByRole is developed in moodle's core.
4. DONE: Not exactly sure... but i would assume so compared in comparison with TinyMCE
5. DONE, most problems occurring with FCK can be solved with updates/pluggins. 
6. ToDo: (not certain)
7. DONE: Has more plugins and extra features than tinyMCE and possibility of an equation editor
8. Part: Safari compatibility through a installing Webkit (experimental)

Note from Stephen Sandhu (original developer).

"I was assigned a 4 month project to work on looking into a better editor for moodle CMS if our department decided to permanently use moodle. I successfully integrated moodle and the latest htmlarea 3 final instead of beta. My time is almost up but I will contain to work on the task off and on."

Adding a wiki page to help members test or help development- search "fck" in wiki or follow this link

YUI Rich Text Editor

BSD licensed. It's lighter than all the former ones but still Beta and isn't as rich in features as Tiny or FCK.

Detailed analysis of Moodle-specific changes from the CVS logs

Unmodified files

These were checked in to their current location (lib/editor/htmlarea) on 3rd April 2006 with the comment "Moving old editor to htmlarea folder." by Janne Mikkonen, who is the default assignee of editor bugs in the tracker.

I don't yet know where these files lived before the move, so I can't look further back in history than this yet.

From the readme, the code is based on HTMLarea 3.0 beta.

  • images/* (except for images/kbhelp.gif).
  • lang/en.js
  • popups/about.html
  • popups/blank.html
  • popups/dialog.css
  • popups/editor_help.html
  • popups/popup.js
  • dialog.js
  • htmlarea.css
  • index.html (blank file)
  • license.txt
  • popupdiv.js
  • popupwin.js (well there were some changes, but only to the language of some comments.)
  • release-notes.html

Files with only XHTML strict and bugfix changes

  • popups/createanchor.php
  • popups/dialog_ins_char.
  • popups/dialog_ins_smile.php
  • popups/fullscreen.js
  • popups/insert_image_std.php
  • popups/insert_image.php
  • popups/insert_table.php
  • popups/link_std.php
  • popups/link.php
  • popups/preview.php
  • popups/searchandreplace.php
  • popups/select_colour.php


Added 30th November 2006 by Vy-Shane Sin Fat with comment "New help button for keyboard shortcuts." - part of the Moodle 1.8 accessibility work.


This is a Moodle-specific file to make HTML area use Moodle's internationalisation system, instead of the one built into HTMLarea.


This plugin was added on 3rd June 2006 by Janne Mikkonen. One change since then, to fix [ MDL-6106] by Petr Škoda.


There are loads of files in here. I have not looked at them at all.


There are loads of files in here. I have not looked at them at all.


Integration with course files, obviously Moodle specific.


What a suspicious file name. Should this really be in CVS? Has had a few minor changes made. Is quite like htmlarea.php, but with quite a lots of changes too, according to diff.


Some minor changes for XHTML-strictness.


Loads of changes (we are up to revision 1.20), which I have not analysed yet.