There is a report here of difficulty getting the compressor to work - and the difficulty being solved simply by copying the gzip files for both PHP and JS into the right directory. However I have tried this and it does not work. I think that the reason is that there are two new versions of the compressor since that report, including a complete rewrite (I have installed version 1.10 dated 21/12/2006). The instructions for installing gzip compressor are now more complicated, since the readme file says this:

Here is a step by step list on how to install the GZip compressor.
  1. Copy the tiny_mce_gzip.js and tiny_mce_gzip.php to the tiny_mce directory. The same directory that contains the tiny_mce.js file.
  2. Remove the current script tag. <script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
  3. Add the new new GZip script <script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce_gzip.js"></script>.
  4. Add the new GZip initialization call that will tell the compressor what to include in the output. This should be the sum of all and themes, plugins contained on page.

This is a good deal more complicated. Where is this initialisation call we are supposed to change? How do you go about getting this to work? Any suggestions would be welcome.
I have already tried simply replacing the tiny_mce.js with tiny_mce_gzip.js, but this did not seem to produce any results. As soon as I remove all the compression and put it back to normal, it works fine.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joel_guesclin’s picture

Title: New version of TinyMCE requires some modification to get Compressor working » Patch to get Compressor working
FileSize
972 bytes

There seem to be two errors in the module:
1) There is a typo which leads to trying to load the GZIP php file instead of the js file.
2) The JS Gzip init function does not get properly included in the page.

I think the attached patch should do the trick - anyway, it works for me using the Compressor 1.10 and TinyMCE module under 4.7.5

csc4’s picture

I get

PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\...\modules\tinymce\tinymce.module on line 235

with PHP5 - it seems to be to do with the piece

$tinymce_invoke_gz = <<<EOD
 <script type="text/javascript">
 tinyMCE_GZ.init({
   $tinymce_settings_gz
 });
 </script>
 EOD;

Does anyone know how I can fix this?

umonkey’s picture

Status: Active » Needs review
FileSize
5.5 KB

Here's an alternative version of the patch against v1.90.4.12, which loads the compressor if available. It also contains theme files for proper initialization, according to the TinyMCE. I've also added a few buttons to the simple theme, such as image, link and unlink, for I think they're vital for an WYSIWYG editor.

umonkey’s picture

Sorry, the last patch contained a syntax error. Here's a correct one.

mstef’s picture

patching file ./themes/tinymce_compact_gzip.js
patching file ./themes/tinymce_full_gzip.js
patching file ./themes/tinymce_simple_gzip.js
patching file ./tinymce.module
Hunk #1 FAILED at 92.
1 out of 1 hunk FAILED -- saving rejects to file ./tinymce.module.rej

no changes made to the editor..still isn't showing

Ryanbach’s picture

It would be a good idea if the 5.X supported this as well.

JohnAlbin’s picture

Status: Needs review » Needs work
FileSize
2.01 KB

umonkey, thanks for contributing a patch. However, you shouldn’t bundle enhancements (in addition to the bug you are trying to fix) into your patch file. It makes it very difficult to review/approve the patch.

Here’s a new patch that is compatible with pre-1.1.0 versions of the compressor as well as (almost) working with 1.1.0. The patch is a 90% solution, as tinyMCE only seems to initialize after you click the “disable wysiwyg” link (very counter-intuitive).

I may not get a chance to look at this until next week, but I wanted other people to look at it and try to fix the last 10%.

JohnAlbin’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Priority: Normal » Critical

The patch is for 5.x-1.x-dev.

JohnAlbin’s picture

FileSize
2.02 KB

Just noticed that the incompatiblity started with 1.0.9, not 1.1.0. This updated patch is the same as the last except for some changes in comments.

JohnAlbin’s picture

Assigned: Unassigned » JohnAlbin
Status: Needs work » Needs review
FileSize
1.18 KB

This new patch is the 100% solution we’re looking for. The TinyMCE compressor docs are a bit vague, but you only need to call tinyMCE_GZ.init() once per page, while still calling tinyMCE.init() once per textarea.

JohnAlbin’s picture

FileSize
1.59 KB

Forgot to update INSTALL.txt in previous patch.

Robrecht Jacques’s picture

I can confirm that the patch in #11 works for the compressor version 1.1.0.

Thanks!

adrinux’s picture

+1
This patch #11 is also working for me on a 5.1 site, latest TinyMCE and compressor versions.

JohnAlbin’s picture

Status: Needs review » Reviewed & tested by the community

That makes 2 people who have successfully used this patch (besides me.) Marking this as RTBC.

m3avrck’s picture

Status: Reviewed & tested by the community » Fixed

Thanks John and everyone else, fixed!

Anonymous’s picture

Status: Fixed » Closed (fixed)