galetahub / ckeditor

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

rails 5.2 couldn't find file 'ckeditor/init' with type 'application/javascript' #881

Closed aditya2727 closed 4 years ago

aditya2727 commented 4 years ago

📝 Provide detailed reproduction steps (if any)

  1. …Using rails 5.2 and active admin 1.4.3 and ckedit 5.1.0
  2. …Installed by following instruction given in ckedit github gem
  3. …when added //= require ckeditor/init inside application.js it showing an error message

Sprockets::FileNotFound in Admin::Blogs#new couldn't find file 'ckeditor/init' with type 'application/javascript'

✔️ Expected result

What is the expected result of the above steps?

❌ Actual result

What is the actual result of the above steps?

📃 Other details


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

brunosanson commented 4 years ago

I'm using the gem Ckeditor in version 4.2.4 and the result is great, I use customizations in the toolbar (hiding several buttons).

ckeditor 4 2 4

After updating the gem to version 5.1.0, my application raises the same message: "couldn't find file 'ckeditor/init' with type 'application/javascript'" in localhost.

When I remove this code //=require ckeditor/init from app/assets/javascripts/application.js my application is running on localhost, however, my custom toolbar is not working. The default toolbar is loading.

ckeditor 5 1 0

My settings:

My code: app/config/initializers/assets.rb:

Rails.application.config.assets.precompile + = %w[ ckeditor/config.js ]

app/config/initializers/ckeditor.rb:

Ckeditor.setup do | config |
  require 'ckeditor/orm/active_record'
end

app/assets/javascripts/ckeditor/config.js:

CKEDITOR.editorConfig = function( config )
{
  config.toolbar = 'MyToolbar';
  config.toolbar_MyToolbar = [
    { name: 'basicstyles', items: ['Bold', 'Italic'] },
    { name: 'links', items: ['Link', 'Unlink'] }
  ];

}

app/views/posts/_form.html.slim:

= f.input :description, as: :ckeditor, input_html: {ckeditor: { toolbar: 'MyToolbar' } }

= javascript_include_tag Ckeditor.cdn_url
mahavir155 commented 4 years ago

I too have the same issue with v5.1.0. @brunosanson With v4.2.4, Active Storage must not be supported. Correct?

patricklindsay commented 4 years ago

couldn't find file 'ckeditor/init' with type 'application/javascript'

Looks like you're upgrading from 4.x to 5.x.

5.x & above currently only supports CDN usage which is why the 'ckeditor/init' was removed.

If you're looking to use Ckeditor without CDN use 4.3.0.


@brunosanson With v4.2.4, Active Storage must not be supported. Correct?

@mahavir155 Correct, Active Storage support was added in 5.1.0

Check changelog for more information - https://github.com/galetahub/ckeditor/blob/master/CHANGELOG.md


@brunosanson

You need to add the JS snippet above the input, I'd recommend adding it in your layout file, within the HEAD tag

andreibondarev commented 4 years ago

I'm not sure what it is within the ckeditor 5.1.0 that's looking for ckeditor/init.js file but I kept getting the following error:

couldn't find file 'ckeditor/init' with type 'application/javascript'

I copied this file over and the issue went away. Running Rails 6.0.2.1, ckeditor 5.1.0 gem and pulling in ckeditor 4.12.11 JS lib.

patricklindsay commented 4 years ago

I'm not sure what it is within the ckeditor 5.1.0 that's looking for ckeditor/init.js file but...

Nothing in 5.1.0 requires that file, however it was in 4.x usage docs to include this so you probably haven't removed the require snippet when upgrading to 5.x

andreibondarev commented 4 years ago

It was not an upgrade, it is a fresh install, so I followed the current README directions.

On Mon, Mar 23, 2020 at 4:01 PM Patrick Lindsay notifications@github.com wrote:

I'm not sure what it is within the ckeditor 5.1.0 that's looking for ckeditor/init.js file but...

Nothing in 5.1.0 requires that file, however it was in 4.x usage docs https://github.com/galetahub/ckeditor/tree/v4.3.0#load-editor-from-gem-vendor to include this so you probably haven't removed the require snippet when upgrading to 5.x

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/galetahub/ckeditor/issues/881#issuecomment-602825069, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEEHYPFAHV7CF3DQNWHRTLRI65Y5ANCNFSM4LGI2UFA .

-- Source Labs LLC www.sourcelabs.io http://www.sourcelabs.io/ Cell: 703-347-4980 <(703)%20347-4980> LinkedIn: https://www.linkedin.com/in/andreibondarev/

vineelvineel commented 2 years ago

@andreibondarev it fixed for me too. How are you dude? Long time

It was not an upgrade, it is a fresh install, so I followed the current README directions. On Mon, Mar 23, 2020 at 4:01 PM Patrick Lindsay @.**> wrote: I'm not sure what it is within the ckeditor 5.1.0 that's looking for ckeditor/init.js file but... Nothing in 5.1.0 requires that file, however it was in 4.x usage docs https://github.com/galetahub/ckeditor/tree/v4.3.0#load-editor-from-gem-vendor to include this so you probably haven't removed the require snippet when upgrading to 5.x — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#881 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEEHYPFAHV7CF3DQNWHRTLRI65Y5ANCNFSM4LGI2UFA . -- Source Labs LLC www.sourcelabs.io http://www.sourcelabs.io/ Cell: 703-347-4980 <(703)%20347-4980> LinkedIn: *https://www.linkedin.com/in/andreibondarev/