I'm trying to install a CKEditor Plugin, using current module release 7.x-1.13 (although have tried latest DEV too) and CKEditor 4.3.3. I've followed the documentation in the README.txt, at http://docs.cksource.com/CKEditor_for_Drupal/Open_Source/Drupal_7/Plugins and the plugin itself (MathJax - http://ckeditor.com/addon/mathjax).

I've configured CKEditor (at /admin/config/content/ckeditor/editg) to look for Plugins within the Libraries (as I figure the CKEditor library less likely to be changed by the client), so installed the MathJax plugin with the /sites/all/libraries/ckeditor/plugins folder. I also added an 16x16 image file within that plugin folder.

Following the suggestion in the README file, I have a custom module, and created a function to call the plugin:

function MYMODULE_ckeditor_plugin() {
  $plugins_path = libraries_get_path('ckeditor', TRUE) . '/plugins/';
  $mathjax_plugin = array(
    'mathjax' => array(
      // Plugin name.
      'name' => 'mathjax',
      // Plugin description - it will be displayed in the plugins management section of the profile settings.
      'desc' => t('Plugin to enable LaTeX input via MathJax'),
      // The full path to the CKEditor plugin directory, trailing slash included.
      'path' => $plugins_path . 'mathjax/',
      // Plugin buttons definition (optional).
      'buttons' => array(
        'mathjax_button' => array(
          'label' => 'MathJax',
          'icon' => $plugins_path . 'images/mathjax-logo.png',
        ),
      ),
    )
  );
  return $mathjax_plugin;
}

I've also added the following to the /sites/all/modules/ckeditor/ckeditor.config.js file (which seems an odd place to add configuration data):

  config.extraPlugins = 'lineutils,widget,mathjax';

And no effect whatsoever - I don't see an additional plugin listed within the CKEditor Profile, nor does a button get rendered. Cleared Drupal and browser caches.

I see a reference in some older posts to plugin.js but no clue as to what should be in it... the downloaded plugin (as created by CKEditor build) is at /sites/all/libraries/ckeditor/plugins/mathjax/dialogs/mathjax.js - is this JS file supposed to be the contents of plugin.js? If so, where should plugin.js be, and what else does it contain?

There doesn't seem to be up-to-date, coherent documentation showing how to activate plugins for Drupal via the CKEditor module. I've no idea how things have changed with CKEditor 4 and the gradual evolution of the module. In the latest DEV release there is no reference to Plugins in the README, so I have suspicions that things may have changed recently.

Grateful for any ideas.

Comments

robcarr’s picture

Issue summary: View changes
StatusFileSize
new26.68 KB
new12.6 KB

So I copied the mathjax.js file into a new plugin.js file, and ensured that all my addressing work. My button now appears when I edit the CKEDitor Profile and dropped it into the desired place, then saved profile. The button appears now only when I'm editing the appearance in the Profile settings, but not in the relevant field toolbar when I create node:

Toolbar appearance being edited in CKEditor Profile settings:

Toolbar appearance when editing node:

Seems a bit of slog so far to add a custom CKEditor plugin - and we're still not there yet...

robcarr’s picture

Title: Installing a CKEDitor Plugin » Installing a CKEDitor MathJax Plugin
Status: Active » Closed (works as designed)

Huge mistake - I downloaded a custom build with the various plugins, rather than downloading each required plugin separately. By subsequently doing a manual download of each required plugin (Widget, Dialog and MathJax), the plugin.js file was included, and Drupal recognises the relevant plugins.

Haven't actually got the MathJax plugin to work, but may try another approach. Apologies for thinking aloud...

robcarr’s picture

For the benefits of building an archive, I found a slightly hackie solution and posted it on another thread #2215409-3: MathJax with CKEditor