spohlenz / tinymce-rails

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

Error: Theme is not a constructor #223

Closed creativetags closed 7 years ago

creativetags commented 7 years ago

I'm seeing a weird issue with TinyMCE not loading after I save a form and go back to edit it again. In the console I see the error thrown: Uncaught TypeError: Theme is not a constructor for this line: editor.theme = new Theme(editor, ThemeManager.urls[settings.theme]);

The weird thing is if I reload the page in the browser it works fine. I'm thinking it could be related to Turbolinks but I understand that should work now because of this:

if (typeof Turbolinks != 'undefined' && Turbolinks.supported) {
  document.addEventListener('turbolinks:before-render', function() {
    tinymce.remove();
  });
}
spohlenz commented 7 years ago

Make sure that the the TinyMCE JS assets are included within the document <head>.

creativetags commented 7 years ago

That would be my issue. Thanks!