Garbage Burrito

TinyMCE GZip Compressor Ruby on Rails Plugin - Take 2

TinyMCE GZip Compressor Ruby on Rails Plugin - Take 2
Ben Kittrell - 10/13/2006 17:33:00
Comments: 35
Last Comment: 06/16/2009 21:50:12

UPDATE: I've finally added conditional Gzip compression. See TinyMCE GZip Compressor Ruby on Rails Plugin  - Take 3 .

After posting in the TinyMCE forums about my GZip Compressor, Spocke let me know that they revamped the other Gzip Compressors, and that I should work off those.  I checked it out and the code is a lot cleaner, so I went ahead and refactored.

This time though I went all out and created it as a plugin.  It supports caching and gzip compression with one caveat.  If you enable caching, then it will always gzip the output.  This means that browsers that don't support gzip will break.  This shouldn't be an issue since any browser that can run TinyMCE should support gzip.  

TinyMCE GZip Compressor Ruby on Rails Plugin

To install it, extract the plugin to vendor/plugins.  The path should look like RAILS_ROOT/vendor/plugins/tiny_mce_gzip.

Add the following line to routes.rb

    TinyMceGzip::Routes.add_routes
    
Change your tiny_mce javascript include to the following.

    <%= javascript_include_tag("tiny_mce/tiny_mce_gzip") %>
    
That's it!

This plugin assumes that TinyMCE is installed in /public/javascripts/tiny_mce.  

Let me know if you have any issues, comments or questions.

Comments: 35
Last Comment: 06/16/2009 21:50:12

Comments

1. Walter McGinnis   |   10/24/2006 00:50:23

Does this assume that the other TinyMCE plugin is installed?

2. Walter McGinnis   |   10/24/2006 00:58:29

D'oh! Didn't see the last line of you post. The other TinyMCE plugin results in this javascript being put under public/javascript/tinymce so that's a pretty good indication that it's required.

Cheers,
Walter

3. Walter McGinnis   |   10/24/2006 01:22:30

One last comment. I promise. Any chance that you be moving this plugin to a subversion repository? If you don't have or don't want to set up the means, rubyforge seems like a good candidate.

I mention this because I prefer to use subversion with externals for plugins.

Cheers,
Walter

4. Ben Kittrell   |   10/24/2006 09:44:02

I was going to wait until I had at least a few people's feedback before I start a project. If you can get it working fairly easily, I'll go ahead and set one up.

5. Benjamin   |   10/25/2006 13:16:23

How does this correctly tie in with the tiny_mce plugin that is located in vendor/plugins/tiny_mce - feel free to email me

6. Walter McGinnis   |   10/26/2006 18:28:20

I finally smoothed out some bumps with using the TinyMCE plugin with ajaxscaffold generated code (see web link for details). After I get some other work out of the way, I'll give your code a try.

When I do, I'll let you know how it goes.

Cheers,
Walter

7. Eduardo   |   11/15/2006 05:22:09

Walter,

You don't need the rails TinyMCE plug-in to use this gzip plug-in.

This plugin (gzip) works fine. Nice job!

8. Igor   |   11/22/2006 23:32:50

There is no such file in public\javascripts\tiny_mce\tiny_mce_gzip.js !
So <%= javascript_include_tag("tiny_mce\tiny_mce_gzip") %> isn't gonna cut it.
I've copied your file lib\tiny_mce_gzip.js over, but still nothing.
Do I add the routing line anywhere I want in routes.rb?
Do I need to include this plugin somehow maybe?
Thanks!

9. Doug Johnston   |   12/05/2006 19:00:56

Cool idea! I got it to work and it does shrink the filesize down to a more manageable 65k. It seems to take a little while to gunzip it on the client side though (5-10 seconds) and on fast connections it seems like it might be faster to just download the original. Anyone else experiencing this? The real problem is that during the 5-10 seconds of gunzipping the file, the browser (Firefox 2.0) appears to lockup. It always recovers, but still, that's a rather undesirable effect. Perhaps too, it's that I'm running in development mode. I'll have to test it in production mode with full caching to see if that makes a difference. Regardless, thanks for the great work!

10. Anonymous   |   12/06/2006 09:13:59

Hi,

Sounds like a great plugin. I cant get it to work unfortunately.

I continually get:
A copy of ApplicationController has been removed from the module tree but is still active!

I was wondering if you might be able to help. Im running PR 1.2.

11. Ben Kittrell   |   12/06/2006 11:32:48

I have not tried it with Rails 1.2 yet. Let me give it a go and see if I get the same error.

12. Anonymous   |   12/09/2006 05:57:18

thanks very much.

I could very well be doing something wrong. But the new routing in 1.2 made me think it might be related to the release.

13. Ben Kittrell   |   12/12/2006 23:52:42

Sorry it took me so long. I tried the plugin using the latest edge, and it seems to work fine. I'll look up that error, but any more information on your end would be helpful.

14. Anonymous   |   12/15/2006 12:01:29

Ill try it again.

I was just doing something stupid Im sure. Ill let you know.

Thanks again.

15. gemp   |   01/10/2007 05:50:27

Hi,

Very nice! Tho your package doesn't seem to be available anymore: Page not found...

16. Jeff McDonald   |   02/27/2007 20:19:04

I get the same error (ArgumentError (A copy of ApplicationController has been removed from the module tree but is still active!):

I'm in the same 'could be my stupid error' camp, but haven't found it yet.

17. Ivan Storck  |  my website   |   03/01/2007 17:24:33

I followed all the steps above but I can't figure out how to get the TinyMCE editor to show up for my textarea. Do I need another plugin or another piece of code?

18. Ben Kittrell   |   03/01/2007 22:44:03

Look at the examples on the TinyMCE website.

web link

19. Tony Jin   |   03/14/2007 22:03:15

Great plugin!
However, I found the new added compressing controller "tiny_mce_gzip_js" takes quite some time, which offsets the time saved by downloading the gzip file.

Is there a way to just generate the gzip only once?

Thanks!

20. Ben Kittrell   |   03/15/2007 08:08:56

Tony,

It should be caching it. I'll look into this a little later.

21. Patricia  |  my website   |   04/03/2007 23:24:55

Show !

Very Good !

22. nancy   |   06/27/2007 19:24:22

I don't know how to use TinyMCE GZip Compressor Ruby on Rails Plugin ,who help me?

23. steve  |  my website   |   08/21/2007 22:34:50

This didn't work for me ... I'm pretty sure I know what I'm doing. Did the latest rails release break this?

24. Jason  |  my website   |   08/28/2007 22:00:10

I short-term solution to the ApplicationController error is found here web link.

25. Remi   |   09/17/2007 19:34:25

How to disable the TinyMCE for one textarea in my page? I'm using ruby on rails.

Thanks

26. Anonymous   |   10/11/2007 06:59:59

dfgfdgdfgdfg

27. Kindy  |  my website   |   10/11/2007 07:02:07

See You have only 2 provissions. either you can change all textarea to MCE or not. ok.
dont think much bigger :D . cool this foolish plugin made my system go 500 error.
:-(

28. Vovka   |   10/17/2007 11:03:40

I disabled TinyMCE for one of my textareas!!! Use code like this:

#when intitializing in <header> in rhtml
tinyMCE.init({mode : "textareas", editor_deselector : "mceNoEditor"});
...
#in <body>
<%= text_area 'event_photo_loader', :caption, :size => "20x3", :class => "mceNoEditor" %>

Remi, it's simple! Just set editor_deselector during initialization and use this name in the capacity of class for your form-item. Enjoy Ruby-with-TinyMCE!

29. Maximka  |  my website   |   11/08/2007 22:48:07

Very Pizdatiy Post

30. antenado  |  my website   |   03/31/2008 09:09:06

very good

31. Ilya Shubin  |  my website   |   05/14/2008 06:26:46

O_O Thanks for plugin, Ben.

But what you say about this web link ?

32. impressora hp  |  my website   |   05/31/2008 13:51:58

impressora
impressora hp
impressora laser
impressora multifuncional
cartucho impressora
tinta impressora
tinta de impressora
driver impressora
impressora deskjet
impresora
impressora fiscal
impressora a laser
impressora canon
impressora zebra
impressora laser hp
impressora matricial
impressora xerox
cartuchos impressora
cartucho de impressora
impressora jato de tinta
cartucho impressora hp
cartucho para impressora
tinta para impressora
impressora termica
impressora cd

33. Celulite Anti  |  my website   |   06/11/2008 23:51:24

Bermuda AntiCelulite Biocerâmica Infravermelho Longo

34. penis grande  |  my website   |   10/11/2008 00:09:54

um super grande

35. jericoacora  |  my website   |   06/16/2009 21:50:12

jericoacora is the best of word !

Post a Comment


Are you human? Please enter the word below.
M3r3axrjac5qcgcxmjy5mjm3ota1


powered by Doodlekit™ Free Website Builder by Doodlebit™ Website Company