spohlenz / tinymce-rails

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

plugin, theme, etc folders not found when app is mounted under a context folder #205

Closed JaneCoder closed 7 years ago

JaneCoder commented 7 years ago

Hello,

I'm working on solving an issue where our app is mounted with a url as https://my_server.company.com/my_app.

When tinymce loads on dev without precompile each individual file is loaded perfectly, such as https://my_server.company.com/my_app/assets/tinymce/plugins/preview/plugin.js

But when using asset precompile in staging I get lots of not found messages for links missing the context, like: https://my_server.company.com/assets/tinymce/plugins/preview/plugin.js

How can I make tinymce know to look for the items using the url with the /my_app/ context under which the app is mounted on apache? Any advice appreciated.

JaneCoder commented 7 years ago

My solution, if anyone else has this issue, was to add

tinymce.baseURL = '<%= "#{$host}/assets/tinymce"%>'

before initialization of tinymce, where $host resolves to https://server.company.com/my_app.