htmlarea custom plugins

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: htmlarea custom plugins.


This (relatively small) patch to Moodle 1.9.x core (to: lib/weblib.php) enable SysAdmin to add folders of extra functionality plugins to the HTMLAREA internal editor without the need to change (patch) any of the lib/editor/htmlarea/htmlarea.php code for each plugin (toolbar icon) that they wish to add. (Actually, very similar to the way we can extend Moodle anywhere else...)

Plus, it enables the SysAdmin to control which plugins are visible (system wide) using a "setting" configuration form. (from the system menu block) Plugins, included with this patch

  • AskBloom - Help teachers setup a more sophisticated instruction to students as defined by BLOOM
  • Resize editor - Extend the size of the editor when it is very small
  • AudioRecorder - Records Audio comments and embed this into the text (+Flash player)
  • Marker - mark text
  • InserSWF - Insert Flash movies into the text
  • InserEmbed - Insert EMBED element anywhere in the text (no need to switch/know html)
  • Dropbox - support Public sharing of dropbox files
  • FileManager - Support for embeding Block FileManager files inside the text
  • IconGallery - Embed Icons (free sets) (update: from the Moodledata/1/icongalleries folder)
  • CellWith - Change the width of a table's column
  • DrawSVG - Vector Graphics editing tool + Insert SVG drawing into the textarea
  • Paint - editor + Insert image into the textarea
  • RemoveNOLINK - remove nolink TAG
  • PageBackground - load an image as background to the entire textarea
  • InsertImage - Drag and Drop image(s) to upload them into the textarea (any user)
  • LineHeight - Set Line Height of current paragraph
  • TableSupport (Disabled) - Table rows and cells configuration
  • Insert PDF - Embed a PDF viewer into the webpage
  • DragAndDropImage - Opens a popup window, into which a user (students) can Drag and Drop Images from their Desktop
  • TinyMCE editor - Enables editing of the current content within a TinyMCE editor using a popup window.
  • DragMath - wrapper for the DragMath Math equation editor plugin + plugin code DragMath 0.7.9 released 10/10/2010 (uses java)(see readme file for install instructions)
  • WIRIS Formula and CAS - wrapper for the WIRIS Math equation editor plugin + plugin code 2.3 beta (uses java) (see readme file for install instructions)
  • VideoRecorder - The video recording applet allows to record video in mp4 format ( H.264 video and AAC audio) and embed it into the text (Inspired by Kevin Brake @
  • HTMLPurify - Clean the text using HTMLPurifier library

Demo Video : Custom Plugins

The Framework

Each plugin folder must include an "opendialog.js.php" file with a function (by the name of the plugin folder) which is called upon clicking the toolbar icon. and an "icon.png" file. if the plugin requires an extra dialog, a "dialog.php" file can be included. (see included samples) if the plugin requires language files, an extra "lang" folder with the relevant lang folders can be included.

A base folder for the plugins must be created by the name "lib/editor/htmlarea/custom_plugins" Attached to this issue is a JavaScript file that handles the opening of a Dialog Window (if the plugin requires one) its name is "nbdialog.js" and it must be placed inside "lib/editor/htmlarea/custom_plugins".

Together with this patch i am attaching several plugins that were made for this framework. ( I will be opening a new issue for each plugin, to track changes in each. and link them back to this issue )

Attached is a clean lib/weblib.php file (Moodle version 1.9.10) + the patch applied to it ( for convenience ) Attached is the patch file which can be applied to all 1.9.x versions Attached is a SysAdmin global setting form "htmlarea_plugins.php" which must be placed inside "admin/settings" folder. ( You, SysAdmin, will have to select any/all the plugins that you wish made available to your users, system wide, before any of them will be visible on the 3rd toolbar strip, in each Editor on your system )


  1. Apply the patch.
  2. Unzip into "lib/editor/htmlarea/custom_plugins"
  3. Copy "htmlarea_plugins.php" to "admin/settings"
  4. As SysAdmin, start a browser and open "http://youmoodle/admin/settings.php?section=htmlareasettings"

select the plugins you wish to enable and save the settings.

  1. Open the HTMLAREA Editor (and checkout your new plugins!)

I would love to get feedback on this patch and any of the attached plugins.

Updated files can always/also be found on :

Please use the Moodle Tracker for bug report and new features requests:

Enjoy :-)