We've been having numerous problems with the bundled HTML-editor with Moodle (versions 1.4 and 1.5). The copy of IE installed on the majority of the machines in the college wouldn't play ball. The HTML editor was a fairly big feature for us so after much searching and testing different HTML editors I managed to get an open-source editor working.
Fortunately its VERY easy to integrate a new editor without breaking the existing editor (should you need to go back to it).
Go to: http://tinymce.moxiecode.com/download.php and download the standard version of the editor.
In the archive find the folder jscripts/tiny_mce. Extract tiny_mce to moodle/lib/editor.
Now open up moodle/lib/weblib.php, scroll down to function (roughly line 2965).
function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0) {
Modify the code of this function to the following:
/// $width and height are legacy fields and no longer used as pixels like they used to be.
/// However, you can set them to zero to override the mincols and minrows values below.
global $CFG, $course;
static $scriptcount; // For loading the htmlarea script only once.
$mincols = 65;
$minrows = 10;
if (empty($courseid)) {
if (!empty($course->id)) { // search for it in global context
$courseid = $course->id;
}
}
if (empty($scriptcount)) {
$scriptcount = 0;
}
/*if ($usehtmleditor) {
if (!empty($courseid) and isteacher($courseid)) {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/htmlarea.php?id='. $courseid .'"></script>'."\n" : '';
} else {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/htmlarea.php"></script>'."\n" : '';
}
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/lang/en.php"></script>'."\n" : '';
$scriptcount++;
if ($height) { // Usually with legacy calls
if ($rows < $minrows) {
$rows = $minrows;
}
}
if ($width) { // Usually with legacy calls
if ($cols < $mincols) {
$cols = $mincols;
}
}
}*/
if ($usehtmleditor) {
if (!empty($courseid) and isteacher($courseid)) {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/tiny_mce/tiny_mce.js"></script>' . "\n" : '';
} else {
echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/tiny_mce/tiny_mce.js"></script>'."\n" : '';
}
//echo ($scriptcount < 1) ? '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/lang/en.php"></script>'."\n" : '';
echo '<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>';
$scriptcount++;
if ($height) { // Usually with legacy calls
if ($rows < $minrows) {
$rows = $minrows;
}
}
if ($width) { // Usually with legacy calls
if ($cols < $mincols) {
$cols = $mincols;
}
}
}
echo '<textarea id="edit-'. $name .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
p($value);
echo '</textarea>'."\n";
Thats it! Its not fully integrated, but it will work and it works really quite well. I'm going to carry on customising it to match our requirements, but all options are fairly simple. I've commented out the changed code, so if you want to go back to the old version just uncomment that, and comment out the 'new' if statement.