spohlenz / tinymce-rails

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

Plugins not working #281

Open ViciousMagician opened 2 years ago

ViciousMagician commented 2 years ago

Found at least Code and Preview are causing issues when deployed to Heroku using latest gem. We did just attempt to update from v4.8.4

When loading either plugin i get this from the browser console.

theme.js?v=5.10.2:1

   Uncaught TypeError: Cannot read properties of undefined (reading 'dom')
at theme.js?v=5.10.2:1:4470
at ze (theme.js?v=5.10.2:1:19745)
at theme.js?v=5.10.2:3:18136
at ve (theme.js?v=5.10.2:1:17897)
at theme.js?v=5.10.2:3:18108
at Object.n (theme.js?v=5.10.2:7:31464)
at Object.find (theme.js?v=5.10.2:3:18084)
at Object.find (theme.js?v=5.10.2:3:18286)
at u (theme.js?v=5.10.2:3:18905)
at As (theme.js?v=5.10.2:3:17022)

Even tried deploying with a minimal yml

toolbar:

istana commented 2 years ago

I bumped into the same exception, changing uglifier configuration helped (in config/environment/production.rb):

config.assets.js_compressor = :uglifier

with

config.assets.js_compressor = Uglifier.new(harmony: true)
ViciousMagician commented 2 years ago

I bumped into the same exception, changing uglifier configuration helped (in config/environment/production.rb):

config.assets.js_compressor = :uglifier

with

config.assets.js_compressor = Uglifier.new(harmony: true)

Thanks I have tried this with no improvement. Updated both staging and production.rb

istana commented 2 years ago

I don't have any other pointers. But I can share versions which work - rails (6.1.4.1), sprockets-rails (3.2.2), sprockets (4.0.2), uglifier (4.2.0) and config (sorry, coffeescript)

  tinymceConfig =
    selector: 'textarea.tinyMCE',
    plugins: 'advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code fullscreen insertdatetime media paste code help wordcount table',
    toolbar: "undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist outdent indent | forecolor backcolor table",
    relative_urls: false,
    remove_script_host : false
ViciousMagician commented 2 years ago

I wasn't able to work it out with this gem but i was able to switch over to using tinymce cloud api version and all works fine

krishnaeverestengineering commented 2 years ago

Me also facing plugin issues. Core plugins are throwing errors (lists, paste). In Development Env everything working fine but Staging Env is not.

gregawoods commented 2 years ago

I can second this. Was having the same error for both pasting and the show source button. I have a couple apps that use this gem and I can say I did not have this problem in version 5.8.1, but I do in 5.10.2.

TypeError: undefined is not an object (evaluating 'e.schema')

Setting my js_processor to Uglifier.new(harmony: true) and recompiling resolved it for me. You can also try terser as a more current alternative to uglifier.