Integrating Code Snippet Plugin
ttseng opened this issue · 2 comments
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
+1
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