Hardcore upgrade resets custom plugins
-
Kieran P
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
Regards
Kieran -
Kieran P
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 << MyPluginWhen 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 << MyPluginThis 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
- 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.
Regards
Kieran
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.