What is the current position with the HTML editor?

What is the current position with the HTML editor?

by Tim Hunt -
Number of replies: 93
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Where we are now



I think the current situation is this:

Moodle ships with two HTML editor components: HTMLarea, which is enabled by default, and TinyMCE, which you can choose to use instead on the admin screens. lib/editorlib.php supports this, and makes different types of editors plug-in-able.

The bad news is that HTMLarea has been 'discontinued'. That is, it is no longer available for download, or meing actively developed. So when it comes to bugs like MDL-7043, we are on our own.

There are various technical reasons stopping us from switching to TinyMCE by default. I'm not entirely sure, but I think the issue might be that despite the name, TinyMCE is huge, and leads to slow download times.

Also, I think that we have done some Moodle-specific customisations to HTMLarea, for example making it possible to choose course files in the insert image dialogue box. This is good for Moodlers, but makes it harder for us to switch to another editor.

What options are available



Trying to find out what had happened to HTMLarea, I discovered that http://www.htmlarea.com/ is now a site that lists other HTML editor components, most of which are commercial, however, there are three leading open-source options:

TinyMCE is still under active development (last release 14th May 2007), and gets a rating of 8.92 from 117 votes. LGPL licensed

Xinha: thanks to the magic of open source, when the original makers discontinued HTMLarea, the community stepped in and continiued development under this new name (Xinha is not HTMLarea). Latest release 16th May 2007. It gets a rating of 8.85 from 80 votes. It is licensed under the old HTMLarea license, which is a variant of the BSD licence.

FCK Editor: Also actively developed with the most recent release 14th June 2007. Gets a rating of 9.07 from 253 votes. Available under of choice of GPL, LGPL or MPL licences. I once talked to some people who had successfully got FCK editor working with moodle, and they said it was easy.

These three options all only support Firefox and IE. They all want to extend support to Safari and Opera, but the FCK site has a nice explanation why that is not really possible, and the constructive steps being taken to change the situation: http://dev.fckeditor.net/wiki/Compatibility

What we should do next



I don't think it is a good idea for us to continue using a discontinued editor component, so what needs to be done:

First, I think we need to work out exactly what Moodle-specific changes were made the the versions of HTMLarea and TinyMCE that are currenly in our code base. That will let us know how much work needs to be done to integrate another editor into Moodle in the same way.

Then, I think we need to look at integrating the latest versions of one of the above editors. Ideally, we would integrate all three, then do a side-by-side comarison. Ideally, we would end up with only one editor in Moodle core. As I see it, we just want one that works, and once we have chosen one, it is silly to spend effort providing long-term support for more than one. However, integration with other editors could be moved to contrib, so people who really want to change can download another one.

I am afraid I am absolutely not volunteering to do any of this. Well, I might have a quick look at Xinha to see if upgrading from HTMLarea to that is the easiest way to fix MDL-7043. But I just thought that having done the above research, I should document it somewhere.
Average of ratings: -
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Tim,

YES PLEASE!

Both Xinha and TinyMCE can handle MDL-7043 and furthermore TinyMCE supports Safari and Opera (test it with Safari or Opera 9- in http://tinymce.moxiecode.com/example_full.php?example=true ). I volunteer to give my (tiny) help for all testing. big grin

But one question - WHERE (which admin screen) do you select TinyMCE ? I must have missed it...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Ah, well, the option used to be under appearance -> HTML editor, except that it had gone now. I expect it has not been there since Moodle 1.6. All the more reason to get things sorted in future.
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
I was also really concerned about moodle with a discontinued htmlarea, so I did some research arriving to same overview and quite similar conclusion.

The differences? I believe will be better to recover tinyMCE as far as heviest part of the work was done. So I suggest include it "outofthebox", but updated to last tinyMCE versions (that include Safari support) in a compressed (gziped) version.

It's completely true that tiny has a "weight challange" but it's a really good development, extremely active, that we can easily adapt to moodle needs and extend with plugins. Do you have any info about the technical issues you pointed to refuse tiny after the work done? It's something I never understood... and I'm sure there are some good reasons that I didn't took in consideration.

We tested tinyMCE on a new module we were working on and works like a charm. More than this, we were able to theme and create "editor profiles" dependent on user's roles.

In a couple of words: A "little fat but functional" TinyMCE is much better than a "hurt of death" htmlarea.

BTW... +1 to avoid Trebuchet as the default font. wink

Thanks a lot to share your thoughts,

m.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have started listing the customisations we have made to HTMLarea here: http://docs.moodle.org/en/Development:Moodle-specific_customisations_to_the_HTML_editor

I think the issues is that HTMLarea currently works quite well for most people. And considering how many installations of Moodle there are around the world, that is a very impressive achievement. Making any major change is a big risk - better the devil you know - and that is why no-one has rushed in and made a big change.

However, I am sure that if someone made a firm commitment to do the work to implement this, and coordinate a suitable amount of testing, I am sure Marting D would be delighed. It would be great to have this situation sorted out by Moodle 2.0. But anyone considering taking this on, I say: it would be very easy to underestimate the amout of work involved.
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Julian Ridden -
We don't need to delete one to replace with another. Having both in there and an admin setting to allow for a switch to Tiny by those who want to use it.

Especially as it is being developed, having this as an option listed under 'experimental' as AJAX was until it is proven the major kinks are worked out.

I too would like to add a vote for replacing HTMLarea. It is harder to continually move forward by having components that are always looking back.
In reply to Julian Ridden

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Sure this is the road.

It will let us keeping htmlarea as the default editor until we will be sure enough of the alternatives (tiny, FCK, Xinha, YUI-RTE or whatever).

In other posts we were talking about a "drop down editor selector on admins pages".
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Dan Poltawski -
I mentioned this issue briefly at the last developer conference and another issue brought up was the lack of a (free) interface to choose images to include with tinymce. Which lead to a brief mention about the imanager plugin as a solution to this problem.

I am absolutely not a fan of HTMLarea, it is a real area of weakness for our users. Often problems with the editor can cause weird problems with access to the user interface - caused by the absolutely awful html it can often generate. All the trash obviously also pollutes the the database with junk (often 100x more junk than real content).
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Urs Hunkler -
Picture of Core developers

YAHOO has released YUI 2.3.0 with a new RTE (Rich Text Editor). I shortly looked at the examples and was impressed. Looks like a very smart and modern RTE.

The editor works in all modern browsers like Safari, Opera, Firefox and IE. The examples show flickr image integration - if that works image linking within Moodle should also work.

Moodle uses the YUI library, why not using the components part of this library instead of other tools?

Are there any Moodle YUI experts around who would like to engage?

In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Dan Poltawski -
Damn you beat me to it. It certainly looks very promising, although it looks liek there isn't image linking support yet. sad
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

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
Oo oo oo oo oo oo (/me jumps up and down).

This looks very promising! AND we are already including all the bulk in Moodle already.
In reply to Martin Dougiamas

Re: What is the current position with the HTML editor?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Now we just need a gullible brave volunteer to agree to do the integration work.
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Looks interesting, but we should be careful, there are several missing features:
  • Tables
  • Smilies
  • Special Characters
  • Handling of MSWord Formats
  • Switching to HTML-Code
  • Right to left text formats
  • Search and replace
  • Undo, redo
In reply to Ralf Hilgenstock

Re: What is the current position with the HTML editor?

by Urs Hunkler -
Picture of Core developers
Ralf, some of the features in your list you may see in the examples on the YUI RTE page.
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Bryan Williams -
I know FF has the spell checker extension, but does anyone know if this editor supports aspell.
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Urs Hunkler -
Picture of Core developers

Dav Glass, the developer of the YUI TRE, wrote the article "Some Notes on the YUI Rich Text Editor".

Ralf's and Brian's postings show that Moodle might go best with a choice for RTEs. Ralf's feature list shows on one hand the need for special features, the limited browser support on the other hand is not mentioned at all.

From Dav's article I read that you won't get both - all features and full browser support.

Moodle may be able to server user needs best with a RTE choice: a slick, fast RTE for everyone and a feature rich editor for special needs.

In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Hi Tim, et. al,

Today Mauno (at http://moodle.org/mod/forum/discuss.php?d=78305) made me remember this post. I visited your contribution at:

http://docs.moodle.org/en/Development:Moodle-specific_customisations_to_the_HTML_editor

that I just hope you don't mind if I updated it with the information I got from my experience with moodle and tinyMCE, and increased with the features exposed in this thread.

I asked Stephen (that is making a really nice job integrating FCK) to fill the requirements accomplished with FCK editor... so Urs, if you have a second, do you mind to do the same with YUI-RTE?

May be then we will be able to see through the clouds. wink

BTW, if is ok with you all, I like to add an extra requirement:

Could we have a skinable editor?

Cheers,

m.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Great to see quick progress - thanks Marc!

Latest versions of TinyMCE, FCK and YUI RTE are all skinnable smile

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -
...and Xinha is skinnable too.
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Wonderful news Mauno.

I known about tiny, Xinha and FCK but I recognize I didn't check this on YUI-RTE.

We are focused on a more child friendly moodle so themes and skins are really important for us. smile
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Urs,

have you tried integration of YUI RTE already? The good news first: I tested running YUI RTE inside moodle 1.8 with YUI 2.3.0 (not a real integration yet) and it really IS the first free editor that works with Safari without installing extra libraries although it has very limited number of functions. Before making any huge trials I have two questions:

1) http://developer.yahoo.com/yui/editor/#knownissues

I just can't get YUI RTE to change the color or background color of an element (if you select text and click a button, the selection is lost). I tried to add work around CSS to couple of places but could not make it work with IE7.

No problems with Firefox or Safari.

2) Should YUI RTE be integrated through theme (header.html) or change structure of index.php and theme files? YUI RTE has skin.css and several js-files to be included inside head-tags, class="yui-skin-sam" to body tag and lots of javascript and css to integration file(s)

In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Integrating new editors into Moodle (also in future) could be much simpler if all integrations had the same structure. Now we need to edit weblib.php to change function print_textarea that contains the main code for editor integration. It could be easier to have some kind of an option to choose just the file where that integration code (to be included) is.

The best possible situation would be that editors live life of their own and editor files can be upgraded to latest versions from any editor development page without any changes to moodle. Moodle only needs a couple of files that specify HOW to use the editor. All editors have their own language packages, skins, plugins etc

I made some hasty tests with TinyMCE and FCK (latest versions available and moodle 1.8) and will try Xinha and YUI RTE integration during the next week. Plugins and some options are different - and they clean/change different tags of source code. Configuration of using relative/absolute addresses should be the same. The image that was added with FCK from site files was no more visible when the content was edited in TinyMCE (because TinyMCE changed the base URL) This kind of changes can be made to editor configuration (as Stephen did for FCK) but I should do same kind of a change for TinyMCE (and other editors to be able to use editor plugins in the same way). If both Xinha and YUI RTE have their own special code filters testing will be even more amusing...big grin

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Janne,

if you have any free time and read this: I am a little bit confused. TinyMCE seems to replace links like

http://homedomain/subfolder/file.php?file=/1/image/image.png

with ../file.php?file=/1/image/image.png. For course files this still works but links on front page get wrong address.

It does not happen to links like

http://homedomain/subfolder/image/image.png

so the change must come from the integration files of TinyMCE (not the core code of TinyMCE). This does not happen in HTMLArea and FCK either.

Do you have any idea where this replacement is done ?

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Found it already...I had to change settings for relative urls to absolute urls from tiny_mce_src.js and tiny_mce.js

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> Integrating new editors into Moodle (also in future) could be much simpler if all integrations had the same structure.

Full agree.

> Now we need to edit weblib.php to change function print_textarea that contains the main code for editor integration. It could be easier to have some kind of an option to choose just the file where that integration code (to be included) is.

Looks like you have the problem very focused. Isn't the first time you reflect about it, don't you? smile

Probably I missed something because when I reviewed the code I always thought that main integration work need to be done at /lib/editorlib.php on loadeditor() function... combined with /lib/editor/editor_name files.

Obviously weblib.php/print_text() will also need some tunning but I think is not the right place to delegate all the work since Jane made really good programming on the classes I mention offering a very flexible structure.

A tinymce example is included as well as a readme... that explains how to use tinyMCE on any module. An student I tutor based his development of a new module (called storytelling) on this approach.

But it drives me to a new question: If I understood Jane's code, the editor to run is decided on every module.

Does is means that we need to change the editor call on every module or I'm also missing something? If this is true, we need to find a different approach.

> The best possible situation would be that editors live life of their own and editor files can be upgraded to latest versions from any editor development page without any changes to moodle. Moodle only needs a couple of files that specify HOW to use the editor. All editors have their own language packages, skins, plugins etc

I also full agree on this.

> Configuration of using relative/absolute addresses should be the same.

Also agree.

BTW, Martin mention that they arrive to the conclusion that paths need to be absolute, but Stephen defend relative paths.

As Stephen I also will vote for relative ones, to facilitate the mobility of content between different moodle installations, and also SCORM exportations but I will easily change my vote as far as good arguments raised. smile

In conclusion... I just differ with you in the place to do the integration work, but probably it's only my ignorance. wink

Thanks for your time and energy Mauno.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

thank you for your feedback! I have just started the same process you have worked with for a long time so I have lots of things to study and learn. It's really great to share experiences and kindred soul with you because one of my main interests from the beginning has been more child friendly themes. I have just for the present felt current theme structure to be a little stiff and complex - particularly styling and positioning of blocks and modules although Urs has done an enormous work and I can't wait to see new improvements in moodle 2.0 and coming versions. Skins and icons have an essential role in themes if we want to create more childlike moodle environment. Admins and teachers may prefer official style in editor but kids would love different kind of buttons when they edit text in forums.

Changes in fckeditor/editor/filemanager/connectors/php/config.php make addresses for images taken from course image folder absolute like http://homedomain/subfolder/file.php?file=/1/image/image.png so FCK image plugin should be "moodle compatible"...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> thank you for your feedback!
Really thanks to you to empower this with your knowledge.

> I have just started the same process you have worked with for a long time so I have lots of things to study and learn.

Don't let me fool you. We have been "thinking" a lot about this during quite a long time... but we aren't expert moodlers as you, just me and 2 students looking for a solution swimming without a clear north.

Now we are starting to clarify some stuff but if you ask me to decide whom to trust... you will be my election. wink

BTW, do you agree in base integration on Jane's work instead of weblib?

> It's really great to share experiences and kindred soul with you because one of my main interests from the beginning has been more child friendly themes. I have just for the present felt current theme structure to be a little stiff and complex - particularly styling and positioning of blocks and modules although Urs has done an enormous work and I can't wait to see new improvements in moodle 2.0 and coming versions.
Yes, this is what drives us to start "space4kids" (aka. moodle4kids) with a few ideas clear on mind: No forks / Community work / KISS approach.

I will keep you informed as soon we get something useful, but I advance that after quite a year we only succeed in been the "vaporwere project of the month". smile Let's see what happens.

> Skins and icons have an essential role in themes if we want to create more childlike moodle environment. Admins and teachers may prefer official style in editor but kids would love different kind of buttons when they edit text in forums.

Exactly! This is why we started a module/patch called "easyEditor" that aimed to offer different editor buttons based on user's roles. When we noticed it mean changing moodle's core we surrender and when to a simplest solution (storytelling).

But approach moodle to kids (6 to 10) won't be only a theme/skining task. We believe that in most cases they will need a wizard model instead of long forms and probably a new course layout. Any case, if it just depends on our advances, we are talking about a far future. smile

> Changes in fckeditor/editor/filemanager/connectors/php/config.php make addresses for images taken from course image folder absolute like http://homedomain/subfolder/file.php?file=/1/image/image.png so FCK image plugin should be "moodle compatible"...

Is not the same that tinyMCE could perform based on url's config values? http://wiki.moxiecode.com/index.php/TinyMCE:Configuration#URL

BTW, I noticed Jane implemented the tinyMCE integration upon tinyMCE file_browser_callback calling moodle's filebrowser popup window.

In combination with those settings it seams really flexible:

Thanks again,

m.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Yes, Janne has made splendid job with both HTMLArea and TinyMCE. If we just had no need to fix bugs in moodle when browsers get new properties but could upgrade latest fixed editor code itself...it's possible for all other editors than HTMLAreasmile 

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

TinyMCE (latest version) has limited but sufficient support for Safari and Opera9 - so does YUI RTE and FCK with Webkit. However some settings in moodle should be changed (can_use_html_editor() in moodlelib.php and maybe some other files) to allow Safari and Opera9 to use html editor, they really can do it outside moodle.

Does anybody have a clear document of all the steps needed to change HTMLArea to TinyMCE and to get TinyMCE (and other possible editors) to work in all different places of moodle? I have been bustling about...Janne, Marc, Tim,...?

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Hi Mauno,

Sorry a lot for the delay in my answer. We are on vacations now in Spain and my couple reduced my computer time to 2 hours a day. tongueout

The only document I know is a readme done by Janne (BTW... MIA in this discussion? wink) s/lib/editor/neweditor_readme.txt

It's short, but clear enough to discover what need to be done ON EVERY module that likes to enjoy tinyMCE instead htmlArea.

I love to say that any of my students did a more extended research, but I discovered they were just concerned in deliver they "last degree project" so they just explain and code the minimum to pass "the exam". sad

If you want a FULL REPLACEMENT, I think you need to review editorlib.php specially loadeditor() and $htmleditor variable.

Just to test, a simple change of:
 $htmleditor = !empty($editorname) ? $editorname : intval($USER->htmleditor);
for:
 $htmleditor = 2;
Will force moodle to show tinyMCE instead of htmlArea on every editable textarea.

Hope this helps, but please, post again if it didn't.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Thanks Marc,

so far I have had most problems with summary fields like editing user profile ("HTMLArea is not always defined") but I will check all code Janne has written. After reading instructions from http://wiki.moxiecode.com/index.php/TinyMCE:Installation I feel the integration could be simpler than it is now. Now HTMLArea is messing up some things but I'll test if changing $htmleditor = 2; is enough...

Safari is still a problem. I tried to change moodlelib.php to make moodle accept that Safari (and Opera) CAN use TinyMCE editor and HTML editor should be enabled but could not make it work. Either there are problems with sessions or editor is not shown but it's just me - I can't find all correct places to change this. The editor used from moodle folders without moodle works perfectly in Safari and Opera9.

Well, if I can't make it work you others certainly can. Next I will test some skins and report back if I find something illustrative...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Hi Mauno,

> so far I have had most problems with summary fields like editing user profile ("HTMLArea is not always defined") but I will check all code Janne has written.

Any case, looks like you made some nice advances. wink

> After reading instructions from
http://wiki.moxiecode.com/index.php/TinyMCE:Installation I feel the integration could be simpler than it is now.

Yes, I thought the same. smile
If you are thinking seriously in remake it, I will suggest a different way to call the editor just based on the ccs class of the textarea and loading the editor's settings and the eJS lib when is needed.

I just can talk about tinyMCE but I'm quite sure the same if feasible with every modern webeditor as FCK and YUI-RTE.

I need to review the code to be sure, but seams to me that just "weblib.php" and "editorlib.php" need to be modified. Did you arrive to the same conclussions?

> Now HTMLArea is messing up some things but I'll test if changing $htmleditor = 2; is enough...


After rethinking it a little I'm unsure about this provisional solution.
Please let us know if it works.

>Well, if I can't make it work you others certainly can. Next I will test some skins and report back if I find something illustrative...

I'm unsure about me been helpful in this task, but if you explain the situation and add a diff I love to make give you a second opinion.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Tags like

$usehtmleditor = can_use_html_editor();
if ($usehtmleditor) {
  use_html_editor("summary");
  }

work ok with tinymce but problems come with lib/formslib.php - tags like

$mform->addElement('htmleditor', 'description', get_string('userdescription'));

do render Tinymce but editor is in a wrong place and tags are not saved.

$mform->addElement('textarea','summary', get_string('summary'), array('rows'=> '10', 'cols'=>'65'));

or

$mform->addElement('text', 'description', get_string('userdescription'));

work ok but render only textarea/text (no Tinymce). Anyway I am just making my own tests with all these editors and I'm sure developers (Janne, Tim and other persons involved) know better how to get tinymce to work with formslib.php and how to tell moodle that Safari likes these new editors.smile

I will take a break here and come back with those skins, icons and themes later.

In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

I forgot to thank you for the latest tips and answer one question. Yes, also FCK and all other editors (except HTMLArea) have this problem. If I'm not wrong formslib.php was written after moodle 1.6 and Janne's code was written to versions before moodle 1.8 (1.7?).

"Normal" way of replacing textareas with any editor looks easy and needs only a little code to check if user may (wants to) use editor, select editor and to call correct integration script. It could be placed to one file (weblib.php or editorlib.php). If moodle is written to check first browser and to decide that Safari can not use htmleditor it gives no editor a change to support Safari in moodle...and this script should be changed.

In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

maybe we should start calling together people who are interested in developing moodle to kids. I did not know about your projects before - I should have searched more - but I know many (lower level) teachers and maybe developers too who desire those qualities you have evolved.

I am willing to co-operate with any such group.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Thinking it all over again this is really a large and interesting question of Usability of moodle for the Old and Young (and special education)
...read for example http://www.stcsig.org/usability/topics/special.html

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Manu, really valuable links. I will review them and forward to our HCI-for-kids expert.

> maybe we should start calling together people who are interested in developing moodle to kids. I did not know about your projects before - I should have searched more - but I know many (lower level) teachers and maybe developers too who desire those qualities you have evolved.

It's not your fault due a lack of searching it's just that we never made a big call to the moodle community because we thought nobody could be really interested. smile

Since the beginning of the project we love to join or lead to an initiative like this so we open it to the community, but we didn't thought globally so was just told locally in the Spanish forum... without much enthusiasm:
https://eduforge.org/projects/space4kids/

After it was briefly commented in a post as a OT:
http://moodle.org/mod/forum/discuss.php?d=59500

And finally we opened a eduforge space at:
https://eduforge.org/projects/space4kids/

A part of this, no much is said. So now we are waiting to get some results to motivate people with facts instead of "ilusion". smile

> I am willing to co-operate with any such group.

And we love to work together. smile

Please, take a look to this last link to see if this well meet your interests and let's talk further in a new post to avoid filling this nice thread with collateral comments.


Thanks for everything Mauno... but specially to make me renew my illusion. wink

Cheers,

m.


In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mark Halvorson -
I would also vote for relative links, as it makes content more portable between courses. For example, our university recently changed the domain name for our moodle server and all those absolute links created a big problem. We had to go through all the links and changed them manually. Now, the solution might not be relative links, but Moodle should have a way of changing those links when the content moves to a different course or server. This is necessary to promote collaboration and exchange within and between learning communities.

- Mark
In reply to Mark Halvorson

Re: What is the current position with the HTML editor?

by Just H -
Hi Mark

I believe the issue of absolute v relative links was nutted out quite some time ago and the problem with relative links has something to do with backups (going from memory of a few posts I read a while back).

We had to go through all the links and changed them manually.

That is the major pain in the proverbial but there is a script to do a search and replace located at http://yoursite/admin/replace.php. Haven't looked for a while, but from what you said, guess this isn't in the docs, or if it is, not very prominent (I only know about it as I was hunting in the forums for a way to change all the links before moving servers).

Info is a bit late for you I guess but may come in useful in the future.

Regards
H
In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by N Hansen -
Sorry for the crosspost but:

I've created an item for this in the tracker: MDL-11113. Assigned it to Martin D. to indicate its importance but it can be reassigned to a more appropriate person.
In reply to N Hansen

Re: What is the current position with the HTML editor?

by Patrick Gosetti-Murrayjohn -
I've just skimmed through this thread, but want to throw in some thoughts on TinyMCE.

Quick background on me--we're just testing whether Moodle would be right for our institution, University of Mary Washington, where we've already done a lot with both Wordpress and Drupal.

Both Wordpress and Drupal use tinyMCE, so it is nice and familiar to users of both those systems. I've also found that the code of tinyMCE is pretty easy to work with, though I've only made very simple plugins so far (side note--it should be relatively straightforward to make a tinyMCE plugin to help generate the code for Cloze questions).

I had the same difficulty I saw mentioned above of not seeing a place to turn on tinyMCE. The quick hack approach I took started with analogy to WP and Drupal--it just turns every textbook into the editor. So, in weblib.php I made it spit out the script to use tinyMCE along with the other javascripts. That put tinyMCE in everything where there was a textarea. Not sure if that's the best way, but it made a quick fix to get something up and running for one of my faculty.
In reply to Patrick Gosetti-Murrayjohn

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Patrick,

did you test TinyMCE with editing user profile, course settings, forums and and other modules and did you try to make changes & get them saved (not only see the editor)? Some textareas using old code are ok and I think it works with moodle 1.6 ok but not with moodle 1.8 or 1.9. I haven't tested moodle 1.7.

If you got it to work with moodle 1.8 or moodle 1.9 would you please be so kind and send a link or attach (zipped) file weblib.php? Maybe I have just missed some place you have edited in weblib.php...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Patrick Gosetti-Murrayjohn -
Good call. I just went through the ones you listed. In the forums, I get a warning message that the content is required when I first click submit. But clicking a second time makes it work.

Other modules I haven't tested yet, nor have I tested how well all the tinyMCE plugins play with Moodle. From experience with Drupal, though, it might be that the format option could affect the results--another area for testing.

A plugin for tinyMCE that I know doesn't work is one that I wrote to insert vowels with macrons. Instead of the unicode coming up when displayed, all I get is a ?. (I've posted elsewhere in the forums about that one--the database settings are good for unicode. )


The changes to the weblib.php are easy. I had started with another suggestion in the forums (if I can find it again, I'll include a reference soon--many apologies for not giving the proper credit) to add tinyMCE for each textarea. It's basically the same code for initializing tinyMCE in any web page.

First, I turned the HTML Editor completely off so they wouldn't duplicate.

Then, in weblib.php at line 2135 (in print_header() ) is this:

/// Add the required JavaScript Libraries
$meta .= "\n".require_js();

Treating tinyMCE as just one more javascript, immediately after that I added the following.

Moxie has good documentation on the options for plugins, setting up the buttons, etc.

Good luck!



//add tinyMCE


$meta .= '<script type="text/javascript" src="'. $CFG->wwwroot .'/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>' ;

$meta .= '<script Xlanguage="javascript" type="text/javascript">

tinyMCE.init({

mode : "textareas",

theme : "advanced",

plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,paste,directionality,fullscreen,noneditable,contextmenu,pgmjLatinChars",

theme_advanced_buttons1_add : "fontselect,fontsizeselect",

theme_advanced_buttons2_add : "insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",

theme_advanced_buttons2_add_before: "cut,copy,paste,pasteword,separator",

theme_advanced_buttons3_add : "emotions,iespell,flash,separator,fullscreen",

theme_advanced_toolbar_location : "top",

theme_advanced_toolbar_align : "left",

theme_advanced_statusbar_location : "bottom",

content_css : "example_full.css",

plugin_insertdate_dateFormat : "%Y-%m-%d",

plugin_insertdate_timeFormat : "%H:%M:%S",

extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",

external_link_list_url : "link.php",

external_image_list_url : "inset_image.php",

flash_external_list_url : "example_flash_list.js",

paste_use_dialog : false,

theme_advanced_resizing : true,

theme_advanced_resize_horizontal : true,

theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1"

});

</script>';




In reply to Patrick Gosetti-Murrayjohn

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Patrick,

IT WORKS!!!!!

So all we need to do is take away htmlarea and use any other editor instead. I'll make some more tests tomorrow but this looks just as simple as it should be...no extra integration code (only the normal way to add editor), editor can be upgraded any time to latest version  and so on. GREAT!!!

And the best thing of all: IT WORKS IN SAFARI TOO. Moodlelib.php would normally check if the browser is Safari or Opera and decide that those browsers can't use editor - now this test is not at all used and TinyMCE works like a dream in Safari.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Now the next problem is how/where to make selection of standard web form or different html editors. Maybe the default selection should be "No editor" = standard web form and then editable array/list of all installed editors. This method really adds editor to all textareas - also to those textareas where selection is: Do not use html editor...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Hi brave couple !!

Sorry to disappear during this last weeks, but we are "back to school" and I was (really still I am) completely overwhelmed. sad

First, my congratulations for the advances !! It really looks like an inflexion point, so thanks in the name of those that hate htmlarea wink
Patrick and Mauno for president !!

Second, just a brief suggestion about where to place the editor selector.
During this preliminary steeps, what about been "conservative" and place the editor in a config.php variable? It's not the best, I know but it will be fast and easy to develop and modify... and we could focus about including this in the web interface as soon as your code will be added in core and more editors succeed on the integration.

Personally I think is more important to develop a clean and easy code (may be based on textareas CSS class) than deal with the interface... but of course this is just my humble opinion. And talking about opinions, any body knows Janne? His point of view could be also valuable.

BTW, really good news about the Safari improvement. The only argument that somebody could find now to avoid tinyMCE (instead of htmlarea) is it's weight, that could partially fixed if is gziped. smile

During this week I will mail a fellow that was working on Moxie (hoping still on business) to ask about editor's comparatives and this "weight challenges" that makes Drupalers and some Moodlers be unsure about this great solution.

Knowing them I'm sure they have good reasons to maintain the code as is now... I mean, they aren't lazy people and they are really concerned about the quality of their soft, so if they are sure about different solutions I think they won't mind to redesign it all

Big thanks and see you soon,

m.
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Hi all,

I read Tim's document from http://docs.moodle.org/en/Development:Moodle-specific_customisations_to_the_HTML_editor again and have some new ideas.

The main idea of theme selector &
http://docs.moodle.org/en/Theme_settings
and
http://docs.moodle.org/en/Theme_basics#Some_more_basic_CSS_files

could be suitable for editors too. We could install latest versions of any editor (htmlarea, tinymce, FCK, Xinha, YUI RTE,...) as "parent-editors" to folder lib/editor but we could also create customized editors using same files as "parent-editors" just like we have themes Standard_logo or Standard_red using Standard theme. In http://wiki.moxiecode.com/examples/tinymce/installation_example_00.php Tinymce has 16 different init examples and skins can be used to different editors the same way. We could have a table mdl_editors with ids no editor, htmlarea, tinymce, tinymceteacher, tinymcekids... or what ever we like and different selection of site-editor, course-editor, activity-editor, course-activity-editor or role/user-editor as well (Marc had a nice example in module Storytelling).

Each editor folder would need a config file and possible integration file (one config file might be enough) and weblib.php or editorlib.php would only need to call correct folder and file. Browser tests for editors should be removed from moodlelib.php and editor config.php could contain variables like canusesafari for special cases - Tinymce and YUIRTE could have value 1, FCK could have 0 or 1 if Webkit is installed, others would have 0. Because of different structure of YUI RTE editor config.php could need different variables for headtags (inside <head> and </head>), bodytags (in body tag) and other scripts in array.

And we might need a new choice to roles - can_select_editor in addition to previous can_use_html_editor. Lots of changes listed but could it be worth of testing in coming versions of moodle. Selection system of themes is great and most of the code is ready to be modified for editors...

...and Marc - you have a good sense of humour! big grin

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Sounds like a plan. Great advances during last week !! big grin

About what could call "webeditor's profile based on Roles" (the only point I thought before all this hurricane of information), do you think we can include something like this to configure every editor?

storytelling_profileditor.png

The idea was stolen from "drupal's tinyMCE module" and the screenshoot is from our "storytelling's module" that creates an textarea to play with tinyMCE (I need to advice code isn't a beauty , but is functional).

After this first fast approach, seams to me that the natural (but far future) steep is an AJAX drag&drop "tool bar" that could be configured at the same as previewed... including buttons, editor's skin selector and roles.

Thanks for your brave work, Mauno.


In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

I think I'll try to create some kind of a test system with 5 different editors during the next week - but this is not an official plan, just my proposal. When I tested your Storytelling module last week I really liked that button system. And yes, it would be nice to have some kind of "editor-editor" for all editors but it may be far away in the future.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
5 different editors??!!! wide eyes
(Yes, it need to be in bold, red and 24pt...)

Mauno, if I go back before summer and I remember what was the situation, more clear am I about the impressive work you are doing here... not just coding, you are also really good with "social engagement". wink

I can't contribute with development time (sorry for this), but count with me for basic beta-testing and suggestions.

Any case, if you need web hosting for this test with ssh access I can create a user in our testing server.

Mail to marc.bria[add]uab.cat and I will forward you with user information.
Let me know if you want me to install a fresh moodle and the version you prefer.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Those 5 editors are: TinyMCE, FCKEditor, YUI RTE, Xinha and Old HTMLArea...

But I have a REAL SURPRISE for you. I asked in previous post from Urs if YUI RTE should be integrated trough theme but have not got any answer (Urs has been busy I guess). Anyway I got YUI RTE to work about week ago and decided today to use Patrick's idea, turned away normal htmleditor from Administration -> Appearance -> HTML Editor and pasted a little different code to one of my themes header.html just before </head> tag and guess what: IT WORKS TOO!

I don't know if anybody has done this before but it makes things really easy. We have already a possibility to select site, course, user and session themes and when editor is a part of theme with all init code - CAN YOU MAKE IT MORE SIMPLE? I could call this a breaktrough, I can now use latest version of any editor and create different style and different skins for different users just by using THEME!

Here is Patrick's example of tinymce changed to theme format and pasted before </head> (change Xlanguage to language - this forum adds that X)

<script type="text/javascript" src="<?php echo $CFG->wwwroot ?>/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">

tinyMCE.init({

mode : "textareas",

theme : "advanced",

plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,paste,directionality,fullscreen,noneditable,contextmenu,pgmjLatinChars",

theme_advanced_buttons1_add : "fontselect,fontsizeselect",

theme_advanced_buttons2_add : "insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",

theme_advanced_buttons2_add_before: "cut,copy,paste,pasteword,separator",

theme_advanced_buttons3_add : "emotions,iespell,flash,separator,fullscreen",

theme_advanced_toolbar_location : "top",

theme_advanced_toolbar_align : "left",

theme_advanced_statusbar_location : "bottom",

content_css : "example_full.css",

plugin_insertdate_dateFormat : "%Y-%m-%d",

plugin_insertdate_timeFormat : "%H:%M:%S",

extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",

external_link_list_url : "link.php",

external_image_list_url : "inset_image.php",

flash_external_list_url : "example_flash_list.js",

paste_use_dialog : false,

theme_advanced_resizing : true,

theme_advanced_resize_horizontal : true,

theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1"

});

</script>

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

And actually language="javascript" in <script language="javascript" type="text/javascript"> is not needed at all, <script type="text/javascript"> should be ok. I made more tests and this theme integration worked with all my browsers including Safari - except that selected editor is used in all textareas but at least in Tinymce it is possible to use multiple configs/inits which means that even a single textarea (with own class) may have own "style" and to use Ask mode (when user clicks the textarea he/she is asked if he/she wants to use tinmce), Ajax load/save, BBcode and so on...

I think it's time for me to "open next door" and start creating those skins I was planning to make in previous post. I may still try to create a different selector of editor, but for me this theme solution is ideal.

Thanks for your engouraging, Marc

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Urs Hunkler -
Picture of Core developers

Mauno,

I have been on holiday and just discovered your and Marc's questions.

  • First I see you have done great work to implement a flexible way of editor handling. Great.

  • Yes, I think the YUI-RTE should be part of the family.

  • No, I don't have the time got get involved into this work in the moment - sorry.

Can anybody of the experienced Moodle developers tell why HTMLarea programmed integration is done the way it is? If there are certain needs for the close integration with the existing option and you don't care for them and just replace all textareas you may break Moodle functionality.

I know that the edit page for resource "Compose a text page" now shows the HTMLeditor for the top textarea and no HTMLeditor for the bottom textarea. When you just replace all textareas with the editor you break Moodle behaviour.

Urs

In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

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
Yes, Urs is right. We need a bit more control over textareas than just putting editors in all of them.

The main reason is that not everyone wants editors, or they want them in some places and not others, or they want them to have different configurations in different places (eg messaging editor is really cut down compared to forum editor). Moodle also supports more than XHTML, we support Moodle format, Plain text format, Markdown etc ... for this Moodle needs to control the interface a bit more, and it's all much easier to control via PHP settings than in the themes.

Like all of you, I'm really looking forward to seeing something better than htmlarea integrated into core ASAP. I'm certain we need to concentrate on finding one product to be the default/core/recommended/tweaked version (even if other people want to maintain alternatives as plugins).

What's the overall feeling at the moment? FCKeditor? TinyMCE? Wait for YUI RTE to improve?
In reply to Martin Dougiamas

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -
Right now I would vote for TinyMCE. Others may comment...
In reply to Martin Dougiamas

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

The biggest minus for TinyMCE comes from missing ImageManager from standard version but it is possible to use ImageManager + Editor v1.1 from
http://sourceforge.net/tracker/index.php?func=detail&aid=1776979&group_id=103281&atid=738747
 
This is an adoption of ImageManager + Editor from Wei Zhuo
http://sourceforge.net/projects/imgmngedt/
(=ImageManager + Editor for HTMLArea)

Or TinyFCK - TinyMCE with FCKEditor file manager http://p4a.crealabsfoundation.org/tinyfck ???

YUI RTE is no way ready and it is "one-man-project" righ now although it might be the editor of the future. FCKeditor is almost equal to TinyMCE but it requires installing Webkit to support Safari (TinyMCE works with Safari and Opera9 without extra plugins). Htmlarea requires nothing but has too many bugs, is not skinnable...and one man (Janne?) can't solve all those problems (perhaps not even Travel engineer Matt Mlinac - the developer of YUI RTE editor). Xinha is a little better than Htmlarea but it does not support Safari or Opera - Xinha has many nice plugins.

Marc has made larger comparison and ideal situation would be to test all features of moodle using these 5 editors like Tim wishes - I haven't gone to that level yet. Are there any other developers that could have already tested these editors - Tim?

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> The biggest minus for TinyMCE comes from missing ImageManager from standard version

Next month will release our first beta of "gallery4kids" that is an activity module to manage personal/group/world pictures for moodle. It will be integrated with tinyMCE as a plugin (BTW I was surprised how easy was building a plugin for tiny).

This module is much better coded than our former "storytelling" smile and plays a lot with YUIs to perform ajax operations and dialogs... but is still beta and don't store files in moodledata.

As Mauno pointed an approach like TinyFCK could be the faster solution for nice image and file management. Any way Janne did a nice job letting tinyMCE call moodle's file manager (take a look to storytelling to see it working)... so it could also be enough as a full replacement of htmlarea.

I mean... nice imageManager is an extra feature that isn't included in htmlarea, isn't it? So I suggest focus in the full replacement and after this let's add more stuff.

BTW, I didn't know about Editor v1.1... and also looks like a feasible choice.

Mauno, you are really digging into those issues. Next time I get a question I know who I need to ask. wink

> Marc has made larger comparison...

This comparative aimed to be detailed, but at the end become quite incomplete.
Any case, other people made some comparatives (not as detailed, but finished) that could help to clarify.
In reply to Martin Dougiamas

Re: What is the current position with the HTML editor?

by Charlie Owen -
What's the overall feeling at the moment? FCKeditor? TinyMCE? Wait for YUI RTE to improve?

If possible, a choice of editors (or no editor) as outlined in previous posts. But if I were forced to plump for one I guess it'd be TinyMCE (but only because I use it in other OSS applications).

What's the deal with Xinha at the moment? I've played with their online demos and it's feeling really good, outputting nice code with ease...
In reply to Martin Dougiamas

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> The main reason is that not everyone wants editors, or they want them in some places and not others, or they want them to have different configurations in different places (eg messaging editor is really cut down compared to forum editor).

All this could be accomplished with CSS selectors that trigger the right editor.
IMHO is the cleanest solution: no inline JS, separating it from clean HTML.

The problem I see for this solution (from my superficial knowledge of the concerned libs) it's that the CSS classes need to be added at module level, isn't it?

Mauno, you know the issue much better than me. What do you think?

> Moodle also supports more than XHTML, we support Moodle format, Plain text format, Markdown etc ... for this Moodle needs to control the interface a bit more, and it's all much easier to control via PHP settings than in the themes.

I don't know if somebody has this in his/her head, but would be really useful an inventory of editor's scenarios. I mean, different instances of different editors we could find coexisting in a single moodle installation.

From Martin we get:
  1. XHTML: default. (profiled by user's role)
  2. XHTML-lite: messages.
  3. Plain text: ?
  4. Markdown: ?
  5. ...
It will help to test the different solutions, but also if we can define (for instance) 5 different cases, they could be associated with 5 different editor's JS init scripts, that we can offer to module-developers to get the right editor without pain... or we can also offer to be modified at admin/editor's settings.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Michael Penney -
Using different editors in different modules will be a big problem from a user training perspective--there are many users who memorize what the various buttons do (e.g. the green one does this) and changing the editor icons will throw these users (many of them in the 'early majority') for a loop.
In reply to Urs Hunkler

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Urs,

nice to see you back again. It's true that theme integration does break some functionality like you said. We should be able to integrate editors using "normal" but selectable replacement of textareas and the current htmlarea integration creates problems for other editors functionality. The most critical part is moodlelib.php that does not allow Safari to use TinyMCE at all and all files using formslib.php fail with other editors than htmlarea. Well, somebody will certainly find a good way to do this integration - sooner or later.wink

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Patrick Gosetti-Murrayjohn -
big grin HOORAY!

Another thing I forgot to mention was that I dropped in a new full copy of tinyMCE from Moxiecode -- that just put more of the plugins in place than were there in what 1.8.2 had.


A while ago I think it had problems in Safari, but I'm delighted to hear that those seem to be fixed.

(And, I think I've tracked my macron issues down to not being tinyMCE-related, but I'm still baffled by why some unicode gets clobbered and other is okay--any ideas out there?)
thanks!

In reply to Patrick Gosetti-Murrayjohn

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
It happens just in the client side (for instance with tinyMCE unziped demos hosted on your server) or appears when data is stored and recovered?

If Mauno suggestion didn't work... did you check Apache's default charset, mysql charset, locales and so on?
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by AjnabiZ ... -

hello

this thread seems to be heading the right direction.

A new editor is really very badly needed.

I installed FCk Editor and it works

In reply to Patrick Gosetti-Murrayjohn

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Patrick,

the problem with forums seems to be that messages are empty by default.

If you replace in mod/forum/post.php tags
$post->message    = '';
with
$post->message    = ' ';
posts can be saved normally with one click but empty messages are not allowed (that's exactly how it should work)

I found one place where editor was not rendered - private messages.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Do we really need webeditor on private messages? tongueout

Mauno, as Urs I'm also worried about the "beauty" of the integration (no offense, you know what I mean tongueout) but as you, during this first steep I also think we need to be practical and it's more important going with it (and get something working) so we can focus on bugs later.

So... go Mauno, go !! smile

BTW, you didn't answer my offer about hosting your testing moodle in our testing sever.

Does it means you finally find a place for it?


In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

I have used a debian test server where I have full control to change (and mess up) anything but if I need a different environment I will contact you immediately. Thanks for your offer!

Keep your countdown for htmlarea up to date...big grin

Can't wait to see your Gallery4kids. My first thought to use theme integration came from the idea to use simple editor with few large buttons and nice skin for kids learning environment (no knowledge of html needed from young users) so we share quite similar trend of ideas. It does not really matter if the selection of editor is made with theme, php script or any possible selector and it is just wisdom that Urs, Martin and all developers of moodle want to keep the main structure of moodle (standard package) as functional as possible. My main interest (sometimes passion) is to test new ways of using moodle and all great activities and plugins it has. Such projects as Gallery4kids make me purr with delight.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> Keep your countdown for htmlarea up to date...

Counter to HtmlArea's death: 97 days. tongueout

> Can't wait to see your Gallery4kids.

Sure? Do you want to see a pre-alpha? wink

> My first thought to use theme integration came from the idea to use simple editor with few large buttons and nice skin for kids learning environment (no knowledge of html needed from young users) so we share quite similar trend of ideas.

We aren't experts (my fellow is starting now studing HCI-forKids) but we are on the same idea... but a childfriendly interface for 6 years old kids need to be different than 12 years old ones, so this is why we were concerned about the "editorByRole" feature.

Any case, some adults have trouble with technologies... sometimes we need to deal with the "digital bounderies"... and most of the cases, the simplest is the best so IMHO a profiled editor, skined and the "editorByRole" feature looks like powerfull tools for every user.

> Such projects as Gallery4kids make me purr with delight

Let me until the end of the month and I will mail you to talk about common interests, because looks like we need to schedule an skype meeting to join efforts. wink
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Chardelle Busch -
Picture of Core developers
>>>But if I were forced to plump for one I guess it'd be TinyMCE (but only because I use it in other OSS applications).<<<

I agree with this--I have even gone so far as to "steal" the icons from TinyMCE, put them into the htmlarea and tweak the styes so it looks just like TinyMCEsmile.

Speaking of other OSS using TinyMCE, has anyone taken a look at some of these to see how they handle Safari/url/image issues?
In reply to Chardelle Busch

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Hi Chardelle,

as soon as I had read your message I checked Joomla 1.5RC2 with Safari and TinyMCE ("normal" package with standard image manager) worked like a charm.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

More good news:

I tested today the latest TinyMCE with the image/file manager of the latest FCKEditor and it worked with Safari and so does Tinymce-Ajax-File-Manager.

The only problem is that

require_once('../../../../../../../../config.php');
$Config['UserFilesPath'] = $CFG->wwwroot .'/file.php?file=/' . $COURSE->id .'/' ;
$Config['UserFilesAbsolutePath'] = $CFG->dataroot .'/'. $COURSE->id .'/' ;

in config.php of FCKEditor file manager connector does not give the correct course id - all images went to site files (course id 1). Stephen was wondering this in another post ( http://moodle.org/mod/forum/discuss.php?d=78305 ) but it can't be a big problem...how do we get correct course id ?

Like Marc I also tested creating some new plug-ins to TinyMCE (image and character pickers) and it is really easy. I may be wrong but it looks like (almost) all plugins can be moved from FCKEditor to TinyMCE and possibly from Xinha to TinyMCE if they do not already exist in TinyMCE. I know that many people have tried to develop a good free online equation editor to give Latex or MathML code and some of these editors work pretty well already. It is also possible to create a very light "equation editor" with utf8 characters, css & images that is a TinyMCE editor plug-in for "lower level mathematics" - with or without Latex/MathML.

If someone of "more experienced developers" had some time to think how htmlarea can be totally replaced with TinyMCE (or some other editor) I could use my energy to create totally new styles, skins and plug-ins for the coming new editor...for all age groups!

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
I can't wait to see your demo site.
Please open it asap !! wink

> If someone of "more experienced developers" had some time to think how htmlarea can be totally replaced with TinyMCE (or some other editor) I could use my energy to create totally new styles, skins and plug-ins for the coming new editor...for all age groups!

I love to help... but I don't have the right profile. sad
My moodle-powers are under yours. wink

Any case, if you share your patches I can give you a second opinion.

As I suggested in a former post, "totally replaced" need to be better defined.
May be we discover isn't as difficult as we thought and you have fixed 90% of the scenarios.

Thanks for everything, Mauno.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Hi Marc,

I have tested now two days image/file manager plug-ins for tinymce and found some new ideas again but code of moodle & htmlarea is getting more and more troublesome when I try to apply it to tinymce plug-ins.

I hope I can open a demo site with a theme selector as an editor selector after a month...there are still many pieces missing from my puzzle.smile

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Obviously, no hurry... and sorry a lot for my little help.
Believe me, I love to dirty my hands with you on it, but with the start of the course I'm really overwhelmed. sad

BTW, today I noticed something. My love of coder is divided between moodle and drupal smile so today, working on a new site I noticed that drupal's tinyMCE module published some useful links:

http://drupal.org/project/tinymce

Where you can find:
http://wiki.moxiecode.com/index.php/TinyMCE:Performance_tuning_TinyMCE
http://sourceforge.net/tracker/?atid=738747&group_id=103281&func=browse

Take a lot to this last one, just in case you find something useful.

---------
Counter to HtmlArea's death: 91 days
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

To speed up "the replacement of htmlarea" I have created two new plugins for TinyMCE:

UNICODE PICKER as a combination/extension of great Uniview 5.0 picker by Richard Ishida ( http://people.w3.org/rishida/scripts/uniview/ ). In htmlarea we can pick some characters using Characters but in my TinyMCE plugin you may select ALL available unicode characters or doubleclick unicode characters to a field and click the text to moodle editor (= write unicode without keyboard) and if some fonts do not have some unicode characters you may toggle between utf-8 and graphics + drag and drop corresponding images (gif) to editor.

FILE/IMAGEMANAGER as a combination/extension of moodle's htmlarea image manager and TinyMCE advimages plugin. The result is a possibility to select and edit images from course files and "common image bank" + settings of advimages plugin (for example mouseover/mouseout images and rtl/ltr selection. I tested also integration of Ajax file manager that has an image editor but had some problems with sessions so I dropped it.

I must still check security and role settings for these plugins but they will be available to download from my demo site after (about) 2-3 weeks. I am also planning to make some role based themes to use different editor init settings for different roles - functionality of plain textareas may be lost but pressing one button in TinyMCE makes editor buttons to disappear and writing plain text is possible again. Filters work as normal. I have not found an easy way to create a sitewide selector for editor mainly because of the method how editors are integrated but using themes I have made a huge progress (from my point of view) during the last weeks and have been able to test different settings with different editors. The more I test them the more convinced I am that the best editor choice is TINYMCE.smile 

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Hi all,

I have got now TinyMCE "PRETTY FUNCTIONAL" with moodle. No special tricks were needed - after reading http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/editor_selector

I just had to add

editor_selector : "form-textarea"

to tinyMCE.init code and plain textareas are plain again. CSS class "form-textarea" is already in moodle core code. My default setting for moodle is "no editor - no files of htmlarea are needed" so I need to write finally init code for htmlarea as well and it should be easy. Next I will check FCKEditor, Xinha and YUI RTE integration and hopefully get the demo selector ready in two weeks ( on schedule ! )

Roles (capabilities to manage files etc) are working fine with theme integration and totally new means of selecting editor for different courses/activities/users could be created but there are some "big questions" left like "is it better to edit editor language files or moodle language files?" We should also be able to install or remove any editor - including htmlarea - without changing any core files and a "common component installer" (like in Joomla) would be super...not only for editors but for themes and activities too. We should be able to change all init settings from simple config files or from database and so on.

I have been "overloading" this discussion with my endless wishlist and reports and I will send one more post with a new title...with a test site address.

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
> to tinyMCE.init code and plain textareas are plain again. CSS class "form-textarea" is already in moodle core code.

Great !!
Sorry if I didn't warn clearly about this nice tinyMCE's feature but reading your posts I thought you also evaluated this solution. Playing with "editor_selector" was exactly what I was trying to say in former posts with:


"...All this could be accomplished with CSS selectors that trigger the right editor..."

As I asked before when Martin asked about "different scenarios": What do you think about CCS selectors as a clean way to offer different editors on different contexts?


> "is it better to edit editor language files or moodle language files?"

Humm... I'm quite sure those lang files will need some kind of adaptation to the "educational world" so +1 to create our own lang pack... or at least, just overwrite the important ones.


> I have been "overloading" this discussion with my endless wishlist and reports and I will send one more post with a new title...with a test site address.

Please, don't !! We are close to be the biggest thread ever. tongueout
Ok, probably is a good idea to open a new post (that could be titled "Mauno talks about the integration of new htmleditors tongueout"... but IMHO you didn't "overloaded" this thread, you keep it alive and I really enjoyed your messages.
I never mind here or in a different post, but please, keep us informed about your advances. They are the reason why I read this forum every night, although those days I feel full overwhelmed. wink
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Thanks again Marc!

Stephen gave one way to integrate FCKeditor by editing weblib.php but if you want to test FCKeditor theme integration with "plain textarea support" try this:

Download the latest version of FCKeditor and place it to folder /lib/editor/fckeditor/

Turn off htmlarea from Administration -> Appearance -> HTML Editor -> Uncheck Use HTML Editor

Open your theme header.html and paste just before </head>:

<script type="text/javascript" src="<?php echo $CFG->wwwroot .'/lib/editor/fckeditor/fckeditor.js' ?>"></script>
        <script type="text/javascript">
        <!--
        function ReplaceAllTextareas() {
                // replace all of the textareas
                var allTextAreas = document.getElementsByTagName("textarea");
                for (var i=0; i < allTextAreas.length; i++) {
                var oFCKeditor = new FCKeditor( allTextAreas[i].name ) ;
if(allTextAreas[i].name!='alltext') {
                oFCKeditor.BasePath = "<?php echo $CFG->wwwroot .'/lib/editor/fckeditor/' ?>" ;
        oFCKeditor.Height = 400 ;
        oFCKeditor.Width = 600 ;
                oFCKeditor.ReplaceTextarea() ;}
                }
        }
        // -->
        </script>

and change body tag to

<body onLoad="javascript: ReplaceAllTextareas()"<?php
    echo " $bodytags";
    if ($focus) {
        echo " onload=\"setfocus(); \"";
    }
    ?>>

All textareas that have a name "alltext" in moodle remain plain textareas and all other textareas are replaced with FCKeditor. No need to change weblib.php, editorlib.php or any other lib files, works with formslib.php and every theme may have different editor style (theme and skin)...

and take away those X from Xonload (this forum adds it). I have a tiny selector ready already and I think the best choice would be to use both php, javascript and css to make different editors "alive".

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Thanks Stephen for the nice tip, but are you thinking in JS in themes as the final solution?

> I have a tiny selector ready already and I think the best choice would be to use both php, javascript and css to make different editors "alive".

It sounds much better. smile

Tonight I requested my "boss" some hours to help you closing all this before the moodlemoot... just in case you need more hands.
I will mail you as soon as I get an affirmative answer.

BTW, until the end of the week I'm so happy to say that Barcelona is hosting the international DrupalCon 2007. I have been there today and I will attend until Saturday but my first impression is that testosterone and beers flows in a similar way than in the moots. smile

-----

Counter to HtmlArea's death: 73 days.
In reply to Marc Bria Ramirez

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Marc,

a short report:

I took functions print_textarea and use_html_editor from weblib.php to a different file for each editor and pasted a require command to theme header.html to get different editor settings for different cases. Wrote a block to select different editors (teachers have different choices than students and guest) and the whole system just works!

It will still take some days to get my site ready with documentation.smile

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Marc Bria Ramirez -
Sounds nice to me.

Mauno, I can wait to see it !! Please, don't keep this intrigue any more... open it asap tongueout

BTW, what are you doing around 15th of next month? In Spain all moodlers are going to join in the moodlemoot'07. It could be a wonderful place to explain your work... meet Martin Dougiamas, visit Cáceres (that it's a nice place) and I promise some beers. wink

Presentations and inscriptions are closed or are going to be closed tomorrow, but I'm pretty sure a communication about "htmlarea replacement" could be classified as "general interest" so if you like I can talk with the organization to find a hole in the timetable.

You know it's hard to me to be serious, but propose is not a joke. I really think you need to be in this meeting.

Best regards,

m.
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by venkatesan iyengar -
I was trying your option with header.html. It is working alright, except a small problem in forum posting. It is required to press 'Post to Forum' button twice to post. the first press of the button gives an error 'Required' in the text area.

venkatesan
In reply to venkatesan iyengar

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

True - if you read the previous posts, messages are empty by default.

If you replace in mod/forum/post.php tags
$post->message    = '';
with
$post->message    = ' ';
posts can be saved normally with one click.

There are still many other things that could be changed in editors but I have been too busy with other projects during the last weeks...

In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by venkatesan iyengar -
Thanks, I missed it. The default course id is always 1. How to make it to actual course id?
In reply to venkatesan iyengar

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -
If you mean the "course folder" where file manager of FCKEditor gets images you need to look at the code of coursefiles.php in htmlarea folder. I edited it for tinymce image plugin but have not yet done it for FCKeditor...if I find some extra time I will test it (in November?)
In reply to Mauno Korpelainen

Re: What is the current position with the HTML editor?

by Matt Gleeson -
Did anyone end up having any success with solving the problem of the course id not being passed to FCKeditor's file manager ie. always ending up in the course id 1 directory?

Regards,

-Matt.
In reply to Matt Gleeson

Re: What is the current position with the HTML editor?

by Mauno Korpelainen -

Yes, I did write the code for FCKEditor (modified version) a year ago http://moodle.org/mod/forum/discuss.php?d=96160 and the old test package may still be on my test server (have not checked it anyway...). I had to change the original integration files a little to be able to send correct course id to file manager of FCKEditor but it was not really difficult after all. Standard method failed to keep course id.

Since that a lot of things have happened and in the future the only (default) editor in moodle 2.0 will be TinyMCE so I did not continue with FCKEditor or Xinha anymore.

In reply to Tim Hunt

Re: What is the current position with the HTML editor?

by Glen Davies -
For anybody coming back to this old thread I have followed on from some of Mauno suggestions using theme overrides and integrated tinymce3 with an image and file browser. More details here
http://moodle.org/mod/forum/discuss.php?d=88382
In reply to Glen Davies

Re: What is the current position with the HTML editor?

by Aaron Fulton -
I'm really quite interested in the tinyMCE intergration. Quite independent of any work that had been done by people on this forum, I had a go at doing the integration with version 3 of tinymce. I used a combination of a theme modification and a modification to some of the moodle file browser code. I have the editor running on my sandbox (http://www.webtolife.org/moodlesandbox/), and have also written a howto on how to do the integration with your own installation (http://webtolife.org/webtolife/content/tinymce-and-moodle-howto)
The code is still in the alpha form, but it is progress
In reply to Aaron Fulton

Re: What is the current position with the HTML editor?

by Mark Pearson -
Aaron,

Take a look at Moodle 1.9 + TinyMCE - clean port discussion. Martin Langhoff from Catalyst has done this and is maintaining the latest Moodle 1.9.x with TinyMCE add-ins. I have just set this up and applied some of the hacks also detailed in the discussion thread and it works well. Save yourself some effort and take a look!

Mark
In reply to Mark Pearson

Re: What is the current position with the HTML editor?

by charles Requena Palomino -
I have the moodle well integrated and ready to install, http://chafarleston.netau.net/archives/ already everything just to install if you want to integrate with most themes have to add the following code in the theme header.html intal the path is / moodle / themes / his_theme, this is the code:

<!-- TinyMCE -->
<script type="text/javascript" src="<?php echo $CFG->wwwroot; ?>/lib/editor/tiny_mce/tiny_mce_gzip.js"></script>
<script type="text/javascript">
tinyMCE_GZ.init({
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
themes : 'simple,advanced',
languages : 'en',
disk_cache : true,
debug : false
});
</script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
file_browser_callback : 'moodleFileBrowser',
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,


// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",

});

function moodleFileBrowser (field_name, url, type, win) {

if(type == 'file'){
var cmsURL = '<?php echo $CFG->wwwroot; ?>/lib/editor/tiny_mce/link.php';
var width = 480;
var height = 400;
}
if(type == 'image'){
var cmsURL = '<?php echo $CFG->wwwroot; ?>/lib/editor/tiny_mce/insert_image.php';
var width = 736;
var height = 430;
}
if(type == 'media'){
var cmsURL = '<?php echo $CFG->wwwroot; ?>/lib/editor/tiny_mce/insert_image.php';
var width = 736;
var height = 430;
}
var courseid = <?php print_r($COURSE->id); ?>;

tinyMCE.activeEditor.windowManager.open({
file : cmsURL + "?id=" + courseid,
width : width,
height : height,
resizable : "yes",
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"

}, {
window : win,
input : field_name,
});
return false;
}
</script>
<!-- /TinyMCE -->


Remember that the code goes between the tags <head> code here</head>

anyway also attached the code



excuse my English