Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

HTML editor 2.0

From MoodleDocs
Revision as of 13:11, 9 August 2021 by David Mudrak (talk | contribs) (Reverted edits by Mudrd8mz (talk) to last revision by German Valero)

Moodle 2.0

This page details the specification of the HTML editor in Moodle 2.0.

HTML editor for 2.0 (April 2010)

What we want

Ticket MDL-11113 discusses most issues.

Requirements

  • 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.

Features

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
  • Tables
  • Themeable (possible to make a theme that fits with Moodle's)

Wishes

  • 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

As of 16 April 2008, the preference goes to TinyMCE.

Plan of action

See: MDL-11113 and MDL-14739

  • 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

Editor-specific information:

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.

See also

Links to forum discussions, tracker, docs, etc.

Using Moodle General developer forum discussions: