tinymce-rails icon indicating copy to clipboard operation
tinymce-rails copied to clipboard

Cannot add custom plugin

Open simusid opened this issue 11 years ago • 2 comments

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.

simusid avatar Aug 17 '14 16:08 simusid

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/...

spohlenz avatar Aug 17 '14 23:08 spohlenz

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.

spodlecki avatar Oct 14 '16 15:10 spodlecki