Simple TinyMCE Integration Into Moodle 1.9.x – June 24, 2010

There are a handful of solutions out there to integrate TinyMCE and Moodle, but some of them are obsolete, and some contain all sorts of things other than the TinyMCE files.

So, I started by reading this entire page, and then figuring out which versions no longer worked, and finally settled on John Stabinger's version (link to stabinger.us was removed, since it appears the site was bought by SEO spammers), which was pretty good, though it contained a lot of extra stuff.

I've tried to keep my version pretty simple, and hopefully you'll save some time by using it.  I downloaded John's version that was built using 1.9.8 from 05/12/2010.  It merged cleanly into my 1.9.9 2010-06-09.

Here is the list of files you'll need to add/modify/replace: 

admin/settings/appearance.php
admin/settings.php
config-dist.php        (and config.php)
course/editsection.html
install.php
adminlib.php
deprecatedlib.php
lib/editor/htmlEditor.class.php
lib/editor/tinymce/    (replace the whole directory)
/lib/editor/tinymce.js.php
/lib/editorlib.php
/lib/form/htmleditor.php
/lib/moodlelib.php
/lib/weblib.php
/message/send.php

Here is a file I generated from subversion showing the changes (I left off the tinymce directory, as well as the tinymce.js.php file, since those are complete replacements/additions) tinymce.moodle.integration.diff.  I am not providing a copy of the tinymce directory, as you can download that from the TinyMCE home page directly.  The only other file you need (from John Stabinger) is: tinymce.js.php, rename it tinymce.js.php when you copy it.

I haven't worked on getting the image browser to work yet, but I'll probably get to that shortly.

PS. I would have posted this to the moodle forums, but they say my email address is invalid, so I can't sign up.  Presumably it would work with another email address, but it isn't worth the effort to workaround their broken system.


Questions? Have Anything to Add?
(your comments will be published on this site - click here for private questions)

Thanks for this. After researching more complicated solutions for a couple of days, this one worked and saved a lot of time. A couple of things:

(1) In the list above, it seems "adminlib.php" and "deprecatedlib.php" are missing the preceding directory "/lib/", since they are not found in root.

(2) When I copied over moodlelib.php from John Stabinger's package, it had a fatal error. I copied back my original file and made the changes listed in the diff file you provide above.

Posted by MHWiz on June 26, 2010, 10:32 pm

jondaley

Thanks for the update.

1. I'll check on the files to see if I accidentally edited the directory off.

1a. I did realize later that I should include the tinymce directory completely, since at some point John's version will change, and perhaps I should have a complete solution posted on my site.

2. Strange. It depends on what version of moodle you have, so perhaps your version is a little different than mine.

2a. applying my diffs to whatever installation of moodle should work the best (as long as there aren't significant changes to the tinymce directory that causes some necessary (and different) changes to tinymce.js.php.

Posted by jondaley on June 28, 2010, 12:38 pm

jondaley

Oh, I also forgot to mention that I am not sure if I'll be able to keep updating this package - I thought I would, but my client has asked for client-specific changes, and part of my point in supplying this version was to have a generic version that everyone could use, rather than be like everyone else out there that puts in lots of other non-necessary changes...

Posted by jondaley on June 28, 2010, 12:39 pm

Thanks for working on this even if you can't continue. I've written a post about my implementation of your method with the addition that I am using the TinyBrowser plugin for image management (including upload), bypassing the "Browse" error and adding some robust image features:

http://muddyhudson.com/blog/1-socialtech/121-moodle-with-tinymce-and-tinybrowser

Posted by MHWiz on June 28, 2010, 3:54 pm

One additional update: I discovered that the spellchecker button wasn't enabled and a key file of the plugin was missing. Take a look at my link above for the easy fix to get spellchecking working if it doesn't.

Posted by MHWiz on July 2, 2010, 4:10 pm

I can't tell you how impossible it is to find a single page with a single set of instructions that enable you to make this implementation. The efforts of everyone to help us move to a useable editor are enormously appreciated. This is what frustrates me: Each page that I find, including this one, seems at some point to direct me to download a file from another location. The problem is that all these files and codes are changing constantly. People don't always want the latest version of a file but a specific version for every file that works on a given date with a given Moodle. It makes it impossible to proceed because the files do not match the instructions or the directory structures do not match (because they are always chaging) and so you do not want to take the risk of killing your entire site in the attempt. Perhaps I would prefer it if someone simply worked out why HTMLAREA does not always display and fixed that!!! Do please keep up the good work on behalf of others.

Posted by Paul Lovatt on January 8, 2011, 4:12 am

jondaley

Yes, Paul - that is a problem. There really isn't anyway to do it completely - since whenever you happen to read this, you will want to be running the latest version of moodle, for security reasons, bug fixes, and other features, and it isn't worth it to me to keep this page up-to-date with every change.

However, I have kept my client's installaton of moodle up-to-date, and haven't run into any problems with tinymce. (I keep the entire site under subversion, so I can merge my local changes with the new versions of moodle).

Posted by jondaley on January 8, 2011, 1:26 pm