Search code examples
ruby-on-railsckeditorcdn

ckeditor code snippet addon rails cdn


I'm trying to use ckeditor with code snippet. The easiest would be to use the CDN and include it as a script tag. But the default ck editor doesn't have the code snippet plugin. If I download a custom package with code snippet included, then I have to modify all the files to work with Rails asset pipeline, which I don't want to do.

How can I put my own files or as a CDN for free, or find some other low-hassle way to incorporate ckeditor custom packages without having to "railsify" it?


Solution

  • You can still use CKEditor official CDN, but use full-all build, which includes all the official CKEditor plugins.

    <script src="//cdn.ckeditor.com/4.4.7/full-all/ckeditor.js"></script>
    

    And you're good to go. Don't forget to load this plugin, e.g. using config.extraPlugins. Like so:

    CKEDITOR.replace( 'editor1', {
        extraPlugins: 'codesnippet'
    } );