#25 ✓resolved
Tadas Tamosauskas

Hardcore upgrade resets custom plugins

Reported by Tadas Tamosauskas | June 2nd, 2010 @ 02:18 AM

I have some custom tinymce plugins in /public/javascripts/tiny_mce/plugins/ when the server is restarted, all of them are gone. Problem - http://github.com/kete/tiny_mce/blob/master/lib/tiny_mce.rb


deletes current dir with all plugins (including custom plugins)
and upgrades all other.

It should be better to replace existent plugins and leave any other, which are not default

Comments and changes to this ticket

  • Kieran P

    Kieran P June 3rd, 2010 @ 09:49 AM

    • State changed from “new” to “open”

    Hey Tadas,

    I agree, the overriding isn't the best approach, but was necessary to get the tiny_mce gem working properly, and simplify the installation procedure.

    If you look here: http://github.com/kete/tiny_mce/blob/master/lib/tiny_mce.rb#L24

    You'll see that it should only be upgrading the TinyMCE source if the tiny_mce.js file has changed. If it's doing it every restart, sounds like it might be broken. If you're familiar with Ruby, I'd gladly accept a patch to do one of the following (or both if you feel up to it):

    • Fix the check of FileUtils.identical? which sounds like it's failing in your case
    • Add a TinyMCE.disable_auto_update! method, which sets a class var, and then use that in the check


  • Kieran P

    Kieran P June 3rd, 2010 @ 03:59 PM

    Hey Tadas,

    We have a rough idea for allowing custom plugins to be inserted into the javascripts/tiny_mce directory, without being overwritten. The idea is still being worked on. Any thoughts are welcome.

    Essentially, each TinyMCE editor plugin gets put into a gem, e.g. tiny_mce-my_plugin. You then add that gem below the gem line for tiny_mce in environment.rb. Each gem will append to a TinyMCE.plugins array, e.g.

    TinyMCE.plugins << MyPlugin

    When tiny_mce runs and puts the tinymce editor source in place, it'll then loop over each plugin, and call install on each plugin, e.g. MyPlugin.install. Each plugin class might subclass TinyMCE::Plugin, which will have a default install method of taking lib/assets/* and copying them into place.

    That covers the following cases:

    • User simply wants a plugin inserted, so they put the source in lib/assets folder of a gem, have a blank plugin class which appends to TinyMCE.plugins (in lib/my_plugin.rb) and then do config.gem for that gem.
    • User wants to edit the source of tiny_mce. They can write a complex install method to do what they want

    An example of the class:

    require 'tiny_mce'
    class MyPlugin << TinyMCE::Plugin
    TinyMCE.plugins << MyPlugin

    This should give it enough configurability to cover most, if not all cases where someone would need to do something to the tiny_mce structure.

    Any thoughts?

  • Kieran P

    Kieran P June 4th, 2010 @ 02:10 PM

    • State changed from “open” to “resolved”

    Hey Tadas,

    We've implemented a very basic plugin system. Using it should allow you to install plugins after TinyMCE has been setup.

    Here is the source of the plugin system: http://github.com/kete/tiny_mce/blob/master/lib/tiny_mce.rb#L76-85

    Here is an example plugin gem: http://github.com/kete/tiny_mce_plugin_example

    In particular, see: http://github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny...

    Please let us know if this functionality can't solve the issues you were experiencing.


Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

People watching this ticket