I've installed the latest version of CKeditor and everything works great. However, I wanted to install the CodeMirror Syntax Highlighting Plugin to use it for my editor.

  1. Downloaded the plugin: http://ckeditor.com/addon/codemirror
  2. Extracted the plugin into the plugins directory
  3. Added this line config.extraPlugins = '[ codemirror ]'; to config.js

When I go to the WYSIWYG Profiles section to enable the plugin it's not there? Has anyone successfully done this? I've also cleared cache multiple times...

Comments

Wysiwyg doesn't use the default config.js file.
You will need to create a small [and reusable] Drupal module to tell Wysiwyg about the plugin instead. See wysiwyg.api.php

sites/all/modules/MYMODULE/MYMODULE.info

name = My custom tweaks
core = 7.x

sites/all/modules/MYMODULE/MYMODULE.module

<?php
/**
* Implements hook_wysiwyg_plugin().
*/
function MYMODULE_wysiwyg_plugin($editor, $version) {
  if (
$editor == 'ckeditor') {
    return array(
     
'codemirror' => array(
        
'extensions' => array(
          
'codemirror' => t('CodeMirror')
         ),
        
'path' => wysiwyg_get_path('ckeditor_plugins') . '/codemirror',
        
'internal' => FALSE,
        
'load' => TRUE,
      ),
    );
  }
}
?>

Then place the plugin files in sites/all/libraries/ckeditor_plugins/codemirror and you won't have to put them back in sites/all/ckeditor/plugins when you upgrade CKEditor.
If that doesn't work, it may be because CodeMirror doesn't like being an external plugin. In that case, simply change 'internal' to TRUE and remove the 'path' key. You should now have "CodeMirror" listed under "Buttons and Plugins".

Note however that this may be better suited for integration with the Wysiwyg CodeMagic module, which could do this for you as well as manage any global CodeMirror settings.

Status:Active» Fixed

@jsheffers - Better yet, add codemirror as a standalone editor, so that effort is focused on making it work directly with WYSIWYG instead of using CKeditor as a proxy. There's work to do on it still, but I was able to get 2.38 working from the patches in that thread.

@jsheffers
so you had to patch your WYSIWYG Module to get 4.x CKEditor working? WYSIWYG is not yet supporting the 4.x CKEditor. Or did you try the plugin on a 3.6 CKEditor Version? This will not work (for me, changing the version-checking was enough).

@TwoD
your .module code gave me a good challenge, which i luckily completed step by step: missing bracket >> wrong hook name >> wrong array structure.
After finally studying another example, i ended up with this working .module code

<?php
/**
* Implements hook_wysiwyg_plugin().
*/
function MYMODULE_wysiwyg_plugin($editor, $version) {
  if (
$editor == 'ckeditor') {
    return array(
     
'codemirror' => array(
        
'extensions' => array('codemirror' => t('CodeMirror')),
        
'path' => wysiwyg_get_path('ckeditor_plugins') . '/codemirror',
        
'internal' => FALSE,
        
'load' => TRUE,
      ),
    );
  }
}
?>

so thanks, a nice success-feeling. ;-)

Note however that this may be better suited for integration with the Wysiwyg CodeMagic module, which could do this for you as well as manage any global CodeMirror settings.

maybe this snippet can be put into CodeMagic, but codemagic (currently) works quite different from the CKEditor-Plugin, so you'd need 2 Vesions of the CodeMirror Lib, which might clash?

@superjerms
sure, standalone CodeMagic would be usefull too. But i guess jsheffers wants to use CodeMirror and CKeditor together, that's my use-case too.

PS:
What currently does work out of the box (no file editing needed) is CodeMirror with CKeditor Module.

Oops, I really messed up that copy-pasted snippet. Sorry about that.

Yes, the CKEditor module guys have [mostly] implemented something I've been wanting to do for a long time; automated plugin file parsing and extraction of the plugin name and all its buttons. It could even be implemented as a separate module using the plugin hook as to not interfere with Wysiwyg while bugs are being worked out, but I've simply not had the time to make something stable enough yet. :(

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.