2

I'm trying to set up image uploading using the tinymce-image-upload gem and the tinymce-rails gem. I'm having trouble with one of the steps in the tinymce-image-upload setup:

Set up TinyMCE as you would normally, but in the call to .tinymce(), add

plugins: "uploadimage"
#toolbar option must include "uploadimage" somewhere to have the button appear

Since I'm using tinymce-rails I have

<%= tinymce %>

at the bottom of the view to initialize tinymce. However, I'm not sure how to add:

plugins: "uploadimage"

In the demo it is added in the javascript like this:

<script type="text/javascript">
$("document:ready", function() {
 $("[rel=tinymce]").tinymce({
  theme: "modern",
  toolbar:    "bold,italic,underline,|,bullist,numlist,outdent,indent,|,undo,redo,|,pastetext,pasteword,selectall,|,uploadimage",
  pagebreak_separator: "<p class='page-separator'>&nbsp;</p>",
  plugins: ["uploadimage"],
  relative_urls: false,
  remove_script_host: false,
  document_base_url: (!window.location.origin ? window.location.protocol + "//" + window.location.host : window.location.origin) + "/",
   })
 });
</script>
user2759575
  • 553
  • 3
  • 25

1 Answers1

2

According to the tinymce-rails docs, https://github.com/spohlenz/tinymce-rails/blob/master/README.md

There are two ways to configure plugins:

1) Use a yml config file for global settings (applied to all tinymce calls) config/tinymce.yml

plugins:
  - uploadimage

2) Include options as a hash in the tinymce method call:

<%= tinymce plugins: ["uploadimage"] %>
Andrew Kuklewicz
  • 10,621
  • 1
  • 34
  • 42