spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

file_browser_callback should be function, being placed as string #204

Open bradlis7 opened 7 years ago

bradlis7 commented 7 years ago

I'm not sure how to get this to work. I tried <%= tinymce file_browser_callback: :fileBrowser %> and <%= tinymce file_browser_callback: 'fileBrowser' %>, but they are both outputting JS strings, but this is a callback function fileBrowser() {...} that exists elsewhere in javascript. Is there a secret to this, or would this have to be added as a special case configuration?

bradlis7 commented 7 years ago

Maybe my answer is #62, though it's a bit of a hack, this works for now.

<%= tinymce file_browser_callback: "function() { return postsFileBrowser.apply(this, arguments); }" %>
juliatjoy commented 7 years ago

Hi,

I would like to know what and where is the postsFileBrowser in the code.

bradlis7 commented 7 years ago

@juliatjoy IIRC, that was my own custom function which showed a modal window.

You might look at this article for more information: https://www.tinymce.com/docs-3x/howto/TinyMCE3x@How-to_implement_a_custom_file_browser/