1
votes

I am using TinyMCE on Rails 5 and I am adding on the WIRIS plugin to enable users to insert mathematical equations. I've followed all the steps on the website to install the plugin, but my editor shows this error:

Failed to load plugin: tiny_mce_wiris from url http://localhost:3000/assets/tinymce/plugins/tiny_mce_wiris/plugin.js

My script at application.html.erb looks like the following:

<script>
    tinymce.init({
        selector: ".tinymce",
        plugins: "tiny_mce_wiris"
    });
</script>

And my editor in one of my views, show.html.erb, looks like this:

<%= form_for ([@question, @question.answers.build]) do |f| %>
  <%= f.text_area :answercontent, :class => "tinymce", :rows => 10, :cols => 90 %> 
  <!-- Before this I had <%= tinymce %> to initialize tinyMCE, and the editor worked well. Now that I have the script I deleted it. -->
  <%= f.submit "Submit", class: "btn btn-default" %>
<% end %>

And in my Assets folder, I have a tinymce directory with the tiny_mce_wiris plugin. I've also installed the gem.

My wiris directory is at:
/app/assets/tinymce/plugins/tiny_mce_wiris (which is the same as the directory path shown in the error)

I've looked up resources and gone through the support on the Wiris page, but I cannot seem to find anyone who has had a similar problem.

Thanks!

+) I have integrated TinyMCE through the Rails Integration for TinyMCE (which uses the Rails asset pipeline), but the config method for plugins is the same, so I'm not sure if this is causing the problem. I've tried adding 'tiny_mce_wiris' to the config/tinymce.yml file under plugins, but this also didn't work.

1

1 Answers

1
votes

Rails.application.config.assets.precompile is where you want to add tiny_mce_wiris.js, the tinymce plugin loader won't do that bit for you. The file you want to look into is config/initializers/assets.rb, the guide isn't elaborating on the topic, but it's there.