tsechingho / ckeditor-rails

Integrate CKEditor javascript library with Rails asset pipeline
https://github.com/tsechingho/ckeditor-rails
MIT License
213 stars 133 forks source link

Add support to rails 7.x #98

Closed mgrunberg closed 2 years ago

mgrunberg commented 2 years ago

Change to support Rails 7.0

miks commented 2 years ago

@tsechingho can you please make ar minor release with this PR?

tbr00 commented 2 years ago

I have tried out your branch in rails 7. It's working, except that I am unable to get my ckeditor/config.js and ckeditor/contents.css to be used. All was fine in rails 6. They are being incorporated in my application.js and application.css OK, but ckeditor is requesting undigested default versions of these from /public/assets and so overriding my custom versions. Have you encountered the same problem?

mgrunberg commented 2 years ago

I made the PR to be able to upgrade a project to Rails 7. Sadly that upgrade got delayed. I can't tell anything about the problem :disappointed:

tbr00 commented 2 years ago

I now have my application working, linked to your repository. The problem is that when deploying to Heroku, they compile both the empty config.js file provided in the gem and the local ckeditor/config.js which is the one actually wanted. What gets served though is whichever of the two was compiled last, which, from a fresh deploy, happens to be the blank one from the gem. So the answer was to deploy, then make an innocuous change to the local ckeditor/config.js and deploy a second time, whereupon it recompiled only the local version, and since that is now the more recent, it is the one that gets served. A similar consideration applies to the ckeditor/contents.css file. Explains a long standing issue from earlier rails versions where sometimes it worked when deployed and sometimes it did not.

tsechingho commented 2 years ago

@tbr00 Your observation is right. The problem is the order determination of compiling when deploy happened. As https://github.com/tsechingho/ckeditor-rails/blob/master/lib/ckeditor-rails/tasks.rake shown, the js/css files are sorted by mtime of files. When js/css files of ckeditor-rails gems are updated, you HAVE TO update your ckeditor/config.js, ckeditor/contents.css as well to keep mtime of your local files are latest ones. I have no better way to change this behavior now.