galetahub / ckeditor

Ckeditor 4.x integration gem for rails
https://ckeditor.com/ckeditor-4/
MIT License
2.22k stars 881 forks source link

Rails 6: config.js is not loading #893

Closed arkniazi closed 3 years ago

arkniazi commented 4 years ago

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.

ACPK commented 4 years ago

@arkniazi - Did you solve the error?

Piyush-Chaudhary commented 3 years ago

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 _classicckeditor 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.

arkniazi commented 3 years ago

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.

stale[bot] commented 3 years ago

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.

anmolgupta98 commented 3 years ago

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.