Skip to content

Integrating Code Snippet Plugin #59

@ttseng

Description

@ttseng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions