spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
816 stars 258 forks source link

Cannot add custom plugin #151

Open simusid opened 10 years ago

simusid commented 10 years ago

I'm using tinymce-rails and the default configuration works perfectly fine. I want to add a custom plugin. The directions say to put my plugin in the asset pipeline:

app/assets/javascripts/tinymce/plugins/mycustomplugin/plugin.js

I created that file and added the example code (from the tinymce website):

tinymce.PluginManager.add('example', function(editor, url) {...}

and I updated tinymce.yml to specify the plugin. The default editor loads but I get a javascript error in plugin.js that says "tinymce is not defined". I'm not sure what I've missed but it doesn't seem like my plugin.js is being processed at the right time and that is why it's not defined.

spohlenz commented 10 years ago

Do you have // require_tree . in your application.js? If so, my guess would be that it is what is causing the problem. You may need to require your other javascripts manually, or maybe put the custom plugin into lib/assets/...

spodlecki commented 8 years ago

The rake task provided by this gem (https://github.com/spohlenz/tinymce-rails/blob/master/lib/tasks/tinymce-assets.rake) is looking in the vendor directory, rather than the app directory.

As a work around, I added this same file to my app's tasks, but changed vendor to app.