Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating Code Snippet Plugin #59

Open
ttseng opened this issue Jan 28, 2015 · 2 comments
Open

Integrating Code Snippet Plugin #59

ttseng opened this issue Jan 28, 2015 · 2 comments

Comments

@ttseng
Copy link

ttseng commented Jan 28, 2015

I am trying to add the CodeSnippet plugin to CKEditor (installed in my Rails app using ckeditor-rails).

To do this, I first added the CodeSnippet plugin folder and all of its dependencies to the directory app > assets > javascripts > ckeditor > plugins (so my plugins folder contains folders for codesnippet, dialog, dialogui, lineutils, and widget).

I then updated my app/assets/javascripts/ckeditor/config.js.coffee to include the following:

CKEDITOR.editorConfig = (config) ->
  config.startupShowBorders = true
  config.resize_enabled = false
  config.scayt_autoStartup = true

  config.language = 'en'
  config.width = '445px'
  config.extraPlugins = 'widget,dialog,dialogui,lineutils,codesnippet'

  config.toolbar_Default = [
    { name: 'basicstyles', items: [ 'Bold','Italic','Underline', '-', 'NumberedList','BulletedList', 'Link','Unlink', 'CodeSnippet','RemoveFormat' ] }
  ]
  config.toolbar = 'Default'
  true

When I try to load a webpage with the CKEditor, I get the following errors in my javascript console:

Uncaught TypeError: undefined is not a function

referring to this line of widgets/plugin.js:

CKEDITOR.style.addCustomHandler( {

and the same error

Uncaught TypeError: undefined is not a function

referring to this line of codesnippets/plugin.js:

editor.addContentsCss( path + 'lib/highlight/styles/' + editor.config.codeSnippet_theme + '.css' );

Anyone able to configure this CKEditor to use the CodeSnippet plugin using this gem?

Stackoverflow question posted here: http://stackoverflow.com/questions/28119912/adding-codesnippet-plugin-to-ckeditor-in-rails-app

@duarme
Copy link

duarme commented Jul 1, 2015

+1

@yyandrew
Copy link

yyandrew commented Jul 3, 2015

I am using the plugin in my project without any problem.you should do the download CodeSnippet and import the plugin again.if the error is still then remove all plugins and just keep config.extraPlugins = 'codesnippet'.
Hope it can help you out.good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants