Here they are - editor integration files

Here they are - editor integration files

by Mauno Korpelainen -
Number of replies: 23

For all testers - here are my current editor test integration files for tinymce, fckeditor, Xinha (and htmlarea):

http://korpelainen.net/editors.zip

I haven't included skins, plugins, selection block + drop down list and other stuff I have been testing because they need still improvement but I will share them later. One brand new theme for younger students with double size editor buttons and some extra features is almost ready... These integration files are no way ment to be perfect but they make testing easier for other persons than just me or Marc -

1) Download the latest versions of editors and unzip them to folders
lib/editor/tinymce
lib/editor/fckeditor
lib/editor/Xinha

2) Edit lib/weblib.php, delete functions
function print_textarea
function use_html_editor

Be carefull - this is the most important part !!!

3) Check that your moodle has use HTML editor selected and change your theme to standard theme. Copy following themes
standard
htmlarea (it's the same as standard theme)
tinymce
fckeditor
Xinha
to theme folder (These are 1.9 standard themes but work ok in moodle 1.8 too. I have added modified functions print_textarea and use_html_editor + all header tags to meta.php except FCKeditor has also body onload tag in header.html - Actually you would need only files meta.php + header.html for fckeditor. You may also take the code from meta.php and paste functions to weblib.php + other scripts to theme head tags if you like.)

Done!

Default editor is now htmlarea and functions in meta.php of themes standard and htmlarea are the same as in normal weblib.php. All old themes will have the default editor unless you have set values
$THEME->metainclude = true;
$THEME->standardmetainclude = false;
$THEME->parentmetainclude = false;
to your theme config.php
In that case replace meta.php with standard, tinymce, FCKeditor or Xinha meta.php
If you want to change tinymce to default editor you just need to copy meta.php from theme tinymce to theme folder standard.

When I started testing these editors I noticed that IE had some conflicts with overlib.js so I copied it and file javascript.php from moodle 1.8 lib folder to moodle 1.9 but I haven't tested yet where that problem came from. There may be some small changes that you may need to to - at least private messages need some fix (I have not had time to check it) Original skins of editors have some css that should be located to meta.php (IE6/IE7 css), javascripts I have included to meta.php could be placed to files like myconfig.js to make themes xhtml valid, themes css and editors configuration should be edited, language files should be added and Xinha's integration is not fully functional. I have also tested YUI RTE but it's not "ready".

I have tested two selection systems: first I set session themes on by adding $CFG->allowthemechangeonurl = true; to site config.php and wrote a block that is visible for teachers and admins only, set theme list ("allowed themes") from administration menu to prevent students and guests seeing all themes because my test site has user themes and course themes on. The second trial was to write an "automatic drop down" list script that reads folder names from lib/editor folder and makes a theme selection list from those folder names. If I need some other modified editors (=themes) I just add empty folders to folder lib/editor. The next idea was to use different names for meta.php files like meta1.php, meta2.php... and use php to select editor meta.php from selection list or place meta code to database. The only problem is that I had to use body onload for FCKeditor (it should be possible to change this) anf YUI RTE has also body tags.

The example code of tinymce is using tiny_mce_gzip.js (TinyMCE compressor), remember to download it (and language files) with tinymce package from http://tinymce.moxiecode.com/download.php. FCKEditor is found from http://www.fckeditor.net/download and Xinha from http://xinha.webfactional.com/wiki/DownloadsPage

 

Average of ratings: -
In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -

...and just to show you how small things may change everything - that tinymce integration I have used does not work in moodle with Safari but if you replace files header.html and meta.php with attached files moodle starts working with Safari. The "bad thing" is that ALL textareas will have Tinymce. The basic problem is in javascript and what kind of javascript Safari does understand.

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -

...and this attached header.html has twice

,unicodes

that should be taken away. It is a plugin I made myself and is not part of official TinyMCE package. If somebody has already tested that code you should notice that meta.php is using the same code as standard moodle functions in weblib.php. Header.html just replaces textareas "form-textarea" created by HTMLArea with TinyMCE editor ! It really does not matter what code generates textareas - the only thing that any editor needs is to know what textareas must be replaced with editor.smile

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -

Safari can really humiliate - once again everything seemed to be working and...it did not. After spending hours with code I finally found that Safari is extremely fussy about the code. Tags like if...else do not necessarely work and any line break or white space can break Safari's html.

For those who WANT TO see safari working with moodle (although in modules like lesson all textfields have editor) here the same two files for tinymce once more. I will keep on searching the correct way to do selections in Safari's javascript because this is not the best way to do it (the first version of tinymce works in all other browsers than Safari)

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Art Lader -

Thank you for all your hard work on this, Mauno!

-- Art

In reply to Art Lader

Re: Here they are - editor integration files

by Mauno Korpelainen -

Thanks Art,

and tomorrow I just remembered one thing from the past  - moodlelib.php and browser check. My first code was allright - it could not work in safari or Opera because moodlelib checks browser and function can_use_html_editor is MSIE for IE(>5.5), Gecko for Gecko browsers and false for other browsers. Because Safari gets "FALSE" it can't use html editor and all my trials to use if ($usehtmleditor) {...} else {...} failed for Safari. ARGHHHHHH! So after all it's not Safari's fault but moodle's fault. The last version here gives class "form-textarea" for all textareas and that's the reason why it works in Safari too.

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -
...my english...today...but I can't change this (Martin can) so right now the only way to get all browsers render editor is to use different code (or theme) for Safari and Opera (the last one) and other code with usehtmleditor selection for other browsers (like in editors.zip of my first post).
In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Marc Bria Ramirez -
Sorry for my silence, Mauno.

As it's said: Thanks a loooot for your work.

I don't know how many hours you dedicate to this development, but I followed all your posts and I'm sure it was hard... and I can find words to thank.

I promises I will test it ASAP I finish a couple of issues I need to fix.
I'm migrating a couple of servers and some web applications just stop working sad

Hope to see you and thanks in person,

Marc.
In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Marc Bria Ramirez -
Dear Mauno,

I'm so sorry, but I still didn't find time to test your improvements... and everything looks like I won't find a moment until (at least) the end of this month. sad

Apart of the apologize, I'm posting because last week I meet Martin Dougiamas in our Spaniard's moodlemoot and I asked (twice) about the editor issue.

I pushed him with tinyMCE as an example of full functional nice webeditor and he argued that is heavy and buggy...

As far as I didn't see tiny as buggy editor (at least it compared to htmlarea) I got shocked and I didn't reply with all the other nice integrations you made as alternatives.

Any case, he said he knows about your work and they are also working on it.

Take care,

m.
In reply to Marc Bria Ramirez

Re: Here they are - editor integration files

by Mauno Korpelainen -

Nice to hear your feedback - I have been busy with http://moodle.org/mod/forum/discuss.php?d=81477

My opinion is that TinyMCE is neither heavy nor buggy - you must just select correct settings for your needs in TinyMCE init code. My work is not connected to any official plans for using/not using other editors than htmlarea but I really would appreciate all actions from Martin or some other official developers of moodle to make TinyMCE the default editor of moodle. Meanwhile I will test other interesting new things - there's no use to waste our time to such projects that have no larger influence.

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Richard Burton -
Hi Mauno

I have tested the TinyMCE and FCKEditor variants of your code and it all works fine other than things like image uploading which in HTMLArea showed the correct moodledata folder so you could just select an image. That I suspect was additional code added by Moodle developers and is a minor point.

The only differences so far that I can see between the 2 is that FCKEditor seems to load more quickly and the preview option actually represents what the page will look like. TinyMCE seems to not show font sizes correctly in the preview. Of course this may be a configuration error on my part.

I agree though that until there is a steer from the main core Moodle developers as I believe the HTML editor is a fundamentally broken part of Moodle spending more time this is probably not worth it. You have provided a good way for people to run basic tests on the various editors and provide feedback but it is up to the core developers to provide the steer now.

Richard
In reply to Richard Burton

Re: Here they are - editor integration files

by Mauno Korpelainen -

Hi Richard,

that missing/needed image/file manager was one of those things I tested last month and it would be an easy part to fix if desired. I created one version of coursefiles (that htmlarea has) to (an unpublished) Tinymce plugin and several other plugins but feel somehow helpless with facts like that moodlelib.php prevents Safari to use editor if "moodle's standard integration" is used. If I had more free time and some hope that Tinymce or FCKEditor could some day be the default editor of moodle I would write the code for changing various init settings myself. I am not a professional programmer and it takes 100 times longer for me to write such code than it takes from people like Martin (because I have to study all basic structures of previous code first).

Yes - the font size for preview is one of the settings of TinyMCE and it is not the same as actual font size. I think all editors have same kind of setting but you don't notice it unless the difference is big enough.

This seems to be more or less a matter of (un)willingness to change "big lines" but I understand perfectly well that there are thousands of other as important parts to fix and develop...sorry if I sound too pessimistic - I love moodle (otherwise I would not use half of my free time to moodle smile )

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Richard Burton -
O well, for now we will continue to use your tweaks, so thanks again for that.

All the best

Richard
In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi, Mauno!

Fear not, I've been following all your work and I still really want to fix the editor in core ASAP. I hope to put some of our time into it after the bugathon (or maybe during if we can fix a lot of bugs that way)

Marc may have misunderstood me. My comments about TinyMCE was just based on the time Janne added it to 1.6 (last year) and the result took a ridiculous 30 seconds to start up (the default package was also many megabytes uncompressed and obviously not tiny smile). Obviously it was some configuration issue since other implementations seem not to have those problems.

We also need to do all the Moodle-specific things to any new editor as discussed before, so that it has at least the same feature set as the current editor (file browsing, character popups, Moodle smileys, accessibility fixes, multi-language support, flexible buttonsets etc)

I'm still seeing lots of multi-editor discussion going on, though ... Even if we support many we still need to have one clear default Moodle editor everyone can rely on as standard.

Based on other comments I think people still like TinyMCE in which case let's focus testing on that and ignore the other editors.
In reply to Martin Dougiamas

Re: Here they are - editor integration files

by Mauno Korpelainen -

Great!

I just noticed that the latest alpha version of TinyMCE (3.0 a2) has again lots of improvements http://tinymce.moxiecode.com/changelog.php?example=true so I could start testing those plugins and skins + XHTML compatible css with moodle again (I have used the last month mostly for testing visually fascinating Flash files...)

Latest stable version 2.1.2 with compressor made TinyMCE 75% smaller and a lot faster to load. But...developers in Moxiecode have done a good job and in version 3.0 (compared to version 2.1.2) reduced the over all script size by 33% and the number of files/requests by 75% so it loads a lot faster again.

If I'm counting it right the loading times now are about 6 % of those values before version 2.1.2. It means today about 1 second instead of 30 seconds. Janne's latest integration in moodle is version 2.0.3, releaseDate 2006-02-13

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -

One note however - TinyMCE version 2.1.2 is very stable and alpha version 3.0 a2 is buggy (as expected from "alpha") - it may take a month or two to get version 3 stable...

In reply to Martin Dougiamas

Re: Here they are - editor integration files

by Marc Bria Ramirez -
Marc may have misunderstood me.

And Marc is so happy to understand you now. tongueout

...so that it has at least the same feature set as the current editor (file browsing, character popups, Moodle smileys, accessibility fixes, multi-language support, flexible buttonsets etc)

Here it is a brief first summary that covers some of those points:
http://docs.moodle.org/en/Development:Moodle-specific_customisations_to_the_HTML_editor

That I extend it with Martin's new items.
In reply to Marc Bria Ramirez

Re: Here they are - editor integration files

by Mauno Korpelainen -

I think we have almost all of these ready - and a little more (new features of TinyMCE compared to htmlarea). Coursefiles.php is working pretty well mixed to advimage plugin of tinymce and the hardest work is to create those forms for settings and language files. I noticed that this issue is in tracker too so I added some notes to http://tracker.moodle.org/browse/MDL-3084

Read also http://moodle.org/mod/forum/discuss.php?d=84293 if Tinymce is going to be integrated through weblib.php (this theme integration is just my personal solution to be able to test all these browsers...)

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Mauno Korpelainen -

And some modules that have a special way to use editor need double check when Tinymce is used: forum, messages, wiki... (but this should be taken care when forms for settings are created)

In reply to Mauno Korpelainen

Re: Here they are - editor integration files

by Ludo (Marc Alier) -
Ahhh... I was afraid you would say so. wink
In reply to Ludo (Marc Alier)

Re: Here they are - editor integration files

by Mauno Korpelainen -

The only problems with wiki are visible in this current default wiki...and if I have understood it right it will be soon replaced with Nwiki.

Nwiki works just GREAT with TinyMCE - this new wiki of your team is a really good improvement again.smile

... I tested Nwiki also with Safari and all three editor selections worked (DFwiki, eWiki with different buttons and HTMLeditor using TinyMCE).

In reply to Ludo (Marc Alier)

Re: Here they are - editor integration files

by Marc Bria Ramirez -
Come on Marc... who could expect a big change like this could be done without any collateral damage. tongueout

Any case, it could mean a little bit more work for your boys... but just in case you like to improve nwiki with the new webeditor features Mauno is developing (editor selection between tiny, fck, rte..., webeditor profile based on role).

Thank you both for the great work done,

Marc (not Ludo)