Hardcore upgrade resets custom plugins
Reported by Tadas Tamosauskas | June 2nd, 2010 @ 02:18 AM
I have some custom tinymce plugins in
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
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
- State changed from new to open
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
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 end 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.
- State changed from open to resolved
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.
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.