I tested integration immediately and Xinha rendered editor a little slower than htmlarea but in first test version I replaced textareas "for-textarea" with a different way than before (without disabeling htmlarea) in moodle 2.0.
Note - just for testing:
First I uploaded the latest nightly build version of Xinha from http://xinha.webfactional.com/wiki/DownloadsPage
Then I changed in weblib.php:
function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='') {
global $CFG, $COURSE, $HTTPSPAGEREQUIRED;
static $scriptcount = 0;
$str = '';
if ($id === '') {
$id = 'edit-'.$name;
}
if (empty($courseid)) {
$courseid = $COURSE->id;
}
if ($usehtmleditor) {
if (!empty($courseid) and has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $courseid))) {
$httpsrequired = empty($HTTPSPAGEREQUIRED) ? '' : '&t;httpsrequired=1';
// needed for course file area browsing in image insert plugin
$str .= ($scriptcount < 1) ? '<script type="text/javascript" src="'.
$CFG->httpswwwroot .'/lib/editor/xinha/XinhaCore.js?id='.$courseid.$httpsrequired.'"></script>'."\n" : '';
} else {
$httpsrequired = empty($HTTPSPAGEREQUIRED) ? '' : '?httpsrequired=1';
$str .= ($scriptcount < 1) ? '<script type="text/javascript" src="'.
$CFG->httpswwwroot .'/lib/editor/xinha/XinhaCore.js'.$httpsrequired.'"></script>'."\n" : '';
}
$scriptcount++;
$str .= '<textarea class="form-textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
$str .= htmlspecialchars($value);
$str .= '</textarea>'."\n";
$str .= '<script type="text/javascript">
//<![CDATA[
document.write(\''.addslashes_js(editorshortcutshelpbutton()).'\');
//]]>
</script>';
if ($return) {
return $str;
}
echo $str;
}
else
{
$str .= '<textarea class="alltext" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">';
$str .= s($value);
$str .= '</textarea>'."\n";
if ($return) {
return $str;
}
echo $str;
}
}
For testing (other configuration files can be edited if needed) I added to standard theme meta.php the init code of Xinha:
<script type="text/javascript">
_editor_url = "<?php echo $CFG->wwwroot .'/lib/editor/xinha/' ?>";
_editor_lang = "en";
</script>
<script type="text/javascript">
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
// This contains the names of textareas we will make into Xinha editors
xinha_init = xinha_init ? xinha_init : function()
{
xinha_plugins = xinha_plugins ? xinha_plugins :
[
'CharacterMap',
'ContextMenu',
'ListType',
'SpellChecker',
'Stylist',
'SuperClean',
'TableOperations'
];
if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
xinha_editors = xinha_editors ? xinha_editors :
[
'form-textarea'
];
xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
Xinha.startEditors(xinha_editors);
}
</script>
Finally I edited in moodlelib.php function can_use_html_editor to let Safari and Opera to use editor. Worked beutifully!
Xinha uses mostly the same code as old htmlArea - Xinha even knows that it is was originally "htmlarea" and renames itself to Xinha.