tsechingho / ckeditor-rails

Integrate CKEditor javascript library with Rails asset pipeline
https://github.com/tsechingho/ckeditor-rails
MIT License
213 stars 132 forks source link

Adding plugins #33

Open tobidelius opened 11 years ago

tobidelius commented 11 years ago

How do one add custom plugins to the ckeditor with this gem?

henrrrik commented 10 years ago

I got it working by putting the plugin (youtube in my case) in /app/assets/javascripts/ckeditor/plugins/ and added it to my config in app/assets/javascripts/admin/ckeditor.js.coffee:

$ ->
  config =
    language: 'en'
    entities_latin: false
    forcePasteAsPlainText: true
    height:'400px'
    format_tags: 'h2;h3;p'
    extraPlugins: 'youtube'
    toolbar:[
      ['Source'], ['Format'], ['Undo','Redo', '-', 'PasteText'],
      ['Bold','Italic','Underline','Strike'], ['NumberedList','BulletedList','-','Blockquote', 'HorizontalRule'],
      ['Link', 'Unlink', 'Anchor'], ['ShowBlocks'], ['Youtube']
    ]

  $('.ckeditor').ckeditor (->), config
ttseng commented 9 years ago

Can you add multiple plugins? I tried adding the codesnippet plugin with its dependencies and am getting the error "Uncaught TypeError: undefined is not a function" in my javascript console, pointing to the following line: CKEDITOR.style.addCustomHandler( {

galikhanov commented 8 years ago

Putt plugins to /vendor/assets/javascripts/ckeditor/plugins

Add to assets.rb:

# ckeditor_rails additional plugins, skins
Rails.application.config.assets.precompile += Dir.glob(Rails.root.join('vendor', 'assets', 'javascripts', 'ckeditor', '**', '*')).select{ |e| File.file? e }

Add to config.js:

config.extraPlugins = 'first_plugin, second_plugin'
vishaltps commented 8 years ago

Not working for me.. i added confighelper extra plugin and add in to my config.js like this config.extraPlugins = 'confighelper'; i got Encoding::InvalidByteSequenceError: "\xED" followed by "n" on UTF-8 (in /home/vishal/.rvm/gems/ruby-2.3.1/gems/sprockets-3.6.3/lib/sprockets/utils.rb:106:in `encode') this error in console..

thiyagarajan commented 7 years ago

Not worked for me also!