Rich Text Editing in Opera 9

Re: Rich Text Editing in Opera 9

by Mauno Korpelainen -
Number of replies: 0

I suppose nobody has managed to create a patch that makes HTMLArea fully functional in Opera (or even the latest version of Opera) - the fact that masking Opera as Internet Explorer makes it work pretty well with HTMLArea does not mean that Opera as Opera itself works with HTMLArea.

You can for example change in lib/moodlelib.php function can_use_html_editor() to

function can_use_html_editor() {
    global $USER, $CFG;

    if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
        if (check_browser_version('MSIE', 5.5)) {
            return 'MSIE';
        } else if (check_browser_version('Gecko', 20030516)) {
            return 'Gecko';
        } else if (check_browser_version("Opera", 0)) {
  return 'Opera';
  }
    }
    return false;
}

and in lib/editor/htmlarea/htmlarea.php line

HTMLArea.is_ie     = ((HTMLArea.agt.indexOf("msie") != -1) && (HTMLArea.agt.indexOf("opera") == -1));

to

HTMLArea.is_ie     = ((HTMLArea.agt.indexOf("msie") != -1) || (HTMLArea.agt.indexOf("opera") != -1));

so that Opera is handled everywhere in htmlarea.php like IE

It almost works with the latest versions of Opera but it did not work at all with the past versions of Opera (pre 9.5?)

For example if textarea is empty at first in Opera you can't write anything but if you click <> and add any character to textarea and click <> again you can add new content with Opera...
or you can open smiley plugin but can't add smileys...

It may not be a big thing to test all parts of code of HTMLArea and to make it functional with the latest Opera but is it really worth of all that trouble - the best patch could have been to change HTMLArea to TinyMCE several years ago. At least I am happy to see this finally happen in moodle 2.0.

PS. Developers of Xinha (successor of HTMLArea when support for HTMLArea was officially discontinued) used some years to make Xinha support Webkit browsers so it is definitely possible to write such a patch... if somebody has time and effort to try... I did make one combined version of Xinha and HTMLArea (Xinha that had moodle modifications from HTMLArea) a year ago but in my opinion we need an editor that has good support, that is regularly upgraded and we have such editors available in the future versions of moodle 2.x - first TinyMCE but it should be possible to integrate CKEditor (successor of FCKEditor), Xinha, YUIRTE etc open source editors to moodle after the latest changes that Petr Skodak made to code of moodle 2.0 (pluggable editor system)