Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: TinyMCE Upgrade.

Obsolete:TinyMCE Upgrade: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 6: Line 6:
When a new version of TinyMCE comes out, a few steps need to be taken to upgrade the version that's distributed with Moodle.
When a new version of TinyMCE comes out, a few steps need to be taken to upgrade the version that's distributed with Moodle.


This document supposes that you are on a unix-like system, can understand a bit of shellscripting, use patch, diff, cvs and other related utilities.
This document supposes that you are on a unix-like system, can understand a bit of shellscripting, use patch, diff, cvs and other related utilities. You also need to have Java installed to be able to use the javascript compressor (unless you have a different compressor than YUI Compressor).


So, here it goes, when a new version of TinyMCE comes out...
So, here it goes, when a new version of TinyMCE comes out...
Line 29: Line 29:
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/moodlenolink/* moodlenolink/
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/moodlenolink/* moodlenolink/
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/spellchecker/* spellchecker/
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/spellchecker/* spellchecker/
* You will need to figure out if the rest of the changes are files that can be deleted, or need to be added, etc.  The idea is to keep the files in Moodle as close as possible to the files distributed by Moxiecode. 'cvs add' and 'cvs rm' accordingly:
* You will need to figure out if the rest of the changes are files that can be deleted, or need to be added, etc.  The idea is to keep the files in Moodle as close as possible to the files distributed by Moxiecode. Call 'cvs add' and 'cvs rm' accordingly, but don't commit anything right now though - let's wait until we can test and make sure that it's all good.
* Apply the patch to use the strings from Moodle:
* Apply the patch to use the strings from Moodle:
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cd ..
  mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cd ..

Revision as of 06:22, 23 September 2008

Moodle 2.0

Starting in Moodle 2.0, TinyMCE is the default html editor.

When a new version of TinyMCE comes out, a few steps need to be taken to upgrade the version that's distributed with Moodle.

This document supposes that you are on a unix-like system, can understand a bit of shellscripting, use patch, diff, cvs and other related utilities. You also need to have Java installed to be able to use the javascript compressor (unless you have a different compressor than YUI Compressor).

So, here it goes, when a new version of TinyMCE comes out...

  • Open a terminal and go in the /lib/editor/tinymce/jscripts folder:
mathieu@temlaz:~$ cd /home/mathieu/workspace/head/lib/editor/tinymce/jscripts/
  • Copy (backup) tiny_mce to tiny_mce_old, remove the old files (but keep the CVS folders):
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cp -Ra tiny_mce tiny_mce_old
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cd tiny_mce
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ for i in `find . \( \! -path "*/CVS" \) -type d`; do rm $i/*; done;
  • Go to the TinyMCE website and download the latest version (the normal version, NOT the development version):
  • Go back to your terminal and unzip the archive in /lib/editor/tinymce/jscripts and copy the new files - note the underscore is important in these names:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ cd ..
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ unzip ~/downloads/tinymce_3_0_9.zip
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cp -Ra tinymce3201/jscripts/tiny_mce .
  • Change to the new folder, do a cvs diff to see what files are missing:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cd tiny_mce
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ cvs -q diff > ../t
  • Copy the missing files (these are those that will always be missing, but you might have more):
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/dragmath/* dragmath/
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/emoticons/* emoticons/
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/moodlenolink/* moodlenolink/
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cp -R ../../tiny_mce_old/plugins/spellchecker/* spellchecker/
  • You will need to figure out if the rest of the changes are files that can be deleted, or need to be added, etc. The idea is to keep the files in Moodle as close as possible to the files distributed by Moxiecode. Call 'cvs add' and 'cvs rm' accordingly, but don't commit anything right now though - let's wait until we can test and make sure that it's all good.
  • Apply the patch to use the strings from Moodle:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce/plugins$ cd ..
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ patch -p0 < ../patch-tinymce_strings.txt
  • Unless it is your lucky day and it applies cleanly, you'll need to apply (at least part of the) the patch manually. If this is the case, you should extract a new patch (note the use of '>>' on the second call):
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ diff -u ../tinymce3201/jscripts/tiny_mce/tiny_mce_src.js tiny_mce_src.js > ../patch-tinymce_strings.txt
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ diff -u ../tinymce3201/jscripts/tiny_mce/tiny_mce_popup.js tiny_mce_popup.js >> ../patch-tinymce_strings.txt
  • Then, you need to recompress TinyMCE. You can probably use any javascript compressor - but if you don't have any, visit to the YUI Compressor home page and download the latest version and uncompress.. I would open a new terminal and do this like:
mathieu@temlaz:~$ cd workspace
mathieu@temlaz:~/workspace$ wget http://www.julienlecomte.net/yuicompressor/yuicompressor-2.3.6.zip
mathieu@temlaz:~/workspace$ unzip yuicompressor-2.3.6.zip
  • Then, going back to the previous terminal... recompress:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ java -jar ~/workspace/yuicompressor-2.3.6/build/yuicompressor-2.3.6.jar tiny_mce_src.js -o tiny_mce.js
  • Test... Load your browser, empty the case, force-reload a page where the editor is used, make sure that it's working as it should (possible problems: language strings, Moodle-specific plugins and theme integration):
  • If everything works fine, commit the changes to cvs. Make sure you've correctly done all the "cvs rm" and "cvs add", if necessary:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts/tiny_mce$ cd ..
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cvs ci -m 'MDL-14739 Upgrade to TinyMCE version X.Y.Z' tiny_mce
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ cvs ci -m 'MDL-14739 New patch to use Moodle langstrings in TinyMCE' patch-tinymce_strings.txt
  • Cleanup:
mathieu@temlaz:~/workspace/head/lib/editor/tinymce/jscripts$ rm -rf tiny_mce_old tinymce3201