galetahub / ckeditor

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

Installing additional plugins in v5.0.0 #849

Closed gambala closed 4 years ago

gambala commented 5 years ago

There is a section in README:

Install additional plugins

You should download necessary plugins with all dependencies and extract them in app/assets/javascripts/ckeditor/plugins/. After that you can include your plugins in app/assets/javascripts/ckeditor/config.js in this way:

CKEDITOR.editorConfig = function (config) {
  config.extraPlugins = 'eqneditor,autosave,';
}

But in case of v5.0.0 (where CDN scripts are used) there is no (at least visible for me) possibility to add additional plugins manually.

For example, I want codemirror addon. And because of inconsistency of versions, there is no matching codemirror script in CDN for ckeditor v4.11.x. So, how can I use it (and other similar addons) in v5.0.0 gem?

satyendra-cis commented 5 years ago

Hello Guys, Any updates on this I am also facing this same issue, I have created a custom plugin to use application documents link in ckeditor, but I am not able to install that custom plugin.

gambala commented 5 years ago

The only way I found is to downgrade to v4.3.0

stale[bot] commented 5 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.

gambala commented 5 years ago

No please no, bot, we definitely need an elegant solution for it :pray:

CaseJnr commented 5 years ago

Anybody found a fix for this

simonhutchings commented 4 years ago

same problem

nitsujri commented 4 years ago

Change the CDN URL to:

# initializers/ckeditor/rb
config.cdn_url = '//cdn.ckeditor.com/4.13.0/standard-all/ckeditor.js'

http://cdn.ckeditor.com/4.13.0/standard-all/plugins/ contains all the plugins! Justify works great for me.

gambala commented 4 years ago

4.13.0

Sure, because it's a 4.x version 😃

nitsujri commented 4 years ago

@gambala sorry, I don't understand? Isn't that what you asked for? Are you saying you want to reference CKEditor 5?

For example, I want codemirror addon. And because of inconsistency of versions, there is no matching codemirror script in CDN for ckeditor v4.11.x. So, how can I use it (and other similar addons) in v5.0.0 gem?

Makes me think you're looking for a 4.x plugin. The code mirror referenced here is only compatible for CKEditor 4.

If you're specifically looking for a v4.11.x codemirror that's here: http://cdn.ckeditor.com/4.11.0/standard-all/plugins/

If you're looking for a CKEditor 5, that's not what this gem is for? At least nothing in the documentation says gem v5.0.0 is for CKEditor 5? Gem v5.0.0's tag still says it's for CKEditor 4.

nitsujri commented 4 years ago

Oh wait, I might be misunderstanding. I think you're asking how do I manually download plugins in gem v5.0.0?

If that is the case, then you don't/there's no need. Per my original comment:

# initializer/ckeditor.rb
Ckeditor.setup do |config|
  # ...
  config.cdn_url = '//cdn.ckeditor.com/4.13.0/standard-all/ckeditor.js'
  # ...
end
# assets/javascript/ckeditor/config.js
CKEDITOR.editorConfig = function (config) {
  config.extraPlugins = 'justify,image2';
  //... original config - REQUIRED
}

There's no downloading of files, literally just reference it in your config.js and CKEditor 4 will go out to the CDN and grab the plugin for you. That was the breaking change in the v5.0.0 gem file.

If this is your problem, this may need some updates to the README.

raghvendra1501 commented 4 years ago

As in rails 5.2 & 6 ckeditor 4.1.3 doesn't work. I upgraded ckeditor to its latest version. It is also working with active storage, but there were few custom made plugin, which were in vendor folder, as soon as I include them using extraPlugins, it says 404 not found error. It was always working in 4.1.3.

nitsujri commented 4 years ago

As in rails 5.2 & 6 ckeditor 4.1.3 doesn't work. I upgraded ckeditor to its latest version. It is also working with active storage, but there were few custom made plugin, which were in vendor folder, as soon as I include them using extraPlugins, it says 404 not found error. It was always working in 4.1.3.

What you're looking for is loading local plugins:

// Enable local "abbr" plugin from /myplugins/abbr/ folder.
CKEDITOR.plugins.addExternal( 'abbr', '/myplugins/abbr/', 'plugin.js' );

// extraPlugins needs to be set too.
CKEDITOR.replace( 'editor1', {
        extraPlugins: 'abbr'
} );

I found that information here: https://cdn.ckeditor.com/

stale[bot] commented 4 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.

amclelland commented 4 years ago

@nitsujri Updating the CDN to the standard-all is perfect, thank you! Makes adding plugins a breeze. This should be in the README