Rails 6: config.js is not loading
arkniazi opened this issue · 5 comments
I am using ckeditor on Rails 6 and as you know Rails have updated javascript folder location fromapp/assets/javascripts
to app/javascript
.
Now I'm trying to overwrite the default config.
And I tried creating ckeditor folder in app/javascript
and in app/assets/javascripts
but it it's not working.
I can't figure out the issue.
As per the points and description you shared, it's looking like it's the adding custom javascript in rails 6 issue more rather than any CKEditor modification issue.
While writing the answer I am hoping that you have not added any custom js till now to your rails app.
Add a file under javascript/packs folder and then require it in application.js like require("packs/classic_ckeditor") where I am assuming classic_ckeditor is your file name under the packs.
Also if this doesn't resolve your issue, please let us know all the files and config related to CKEditor in your app.
Hey @Piyush-Chaudhary Thanks for your response.
I was trying to load CKEditor files manually. But It wasn't working.
So I used CKEditor gem instead. And I'm loading the CKEditor like this:
<%= javascript_include_tag Ckeditor.cdn_url %>
It's working fine now.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @Piyush-Chaudhary I am using rails 6 and facing a similar issue. I tried doing what you suggested, creating classic_ckeditor named file in app/javascript/packs/classsic_ckeditor and referencing that in application.js. But that doesn't work. It throws up an error of
classsic_ckeditor.js:1 Uncaught ReferenceError: CKEDITOR is not defined
at Object../app/javascript/packs/classic_ckeditor.js
Besides this file, I have got:
app/models/ckeditor -> 3 files: asset.rb, attachment_file.rb, picture.rb
app/config/initializers/ckeditor.rb
Migration files of ckeditor, changes made in some other files, according to READme in github.
Actually what @arkniazi said works for me also. But I want custom toolbar with some plugins.