Extra module uploaded in FCKeditor plugin folder does not show up (or if shows up does not show up in the actual text editor) Buttons and plugins admin area of Wysiwyg.

Wysiwyg version used http://ftp.drupal.org/files/projects/wysiwyg-6.x-2.0.tar.gz
Drupal version 6.15

The readme file of this FCKeditor plugin (http://www.vishalon.net/IndicResources/IndicIME.aspx) says

Plugin Installation:
1. Unzip the file on your local hard disk.
2. Upload "indicime" folder to FCKEditor_ROOT/plugins/
3. In the fckconfig.js file write "FCKConfig.Plugins.Add( 'indicime' );" and in ToolbarSets initialization add "indicime" and "indicimehelp" button for language dropdown list and help button

However following the steps, no luck.

Steps followed

FCKConfig.Plugins.Add( ‘indicime’ );
FCKConfig.ToolbarSets["Default"] = [
['indicime','indicimehelp'],

added the above in …\sites\all\libraries\fckeditor\fckconfig.js, taking care where to end lines with or without comas

This however did not show up the module and had to add

‘indicime’ => array(
‘path’ => $editor['library path'] . ‘/editor/plugins’,
‘extensions’ => array(
‘indicime’ => t(’indicime’),
),
‘internal’ => TRUE,
‘load’ => TRUE,
), 

( no idea if this was the thing to do)

in …\sites\all\modules\wysiwyg\editors\fckeditor.inc

This shows the module in the admin area but buttons are not seen by the user.

Comments

twod’s picture

Status: Active » Closed (works as designed)

Since Wysiwyg module allows you to enable/disable buttons and plugins using a GUI on the server it needs to have full control over some settings, like those which needs customization when installing native editor plugins. A goal of Wysiwyg module is to aliminate/minimize the changes in files belonging to either the editor library or the Wysiwyg module itself. This will allow for much easier upgrades since there is no need to keep track of manual changes between versions.

To make Wysiwyg module aware of each external native plugin - so it can correctly assemble the lists of buttons and plugins to load - you create a very small module which implements hook_wysiwyg_plugin(). You can of course put this hook into any existing module as well. Details on how this hook is implemented is described in wysiwyg.api.php (the version in 6-x.2.x-dev is up to date) The hook allows you to specify the script file to load, which buttons it has (or 'extensions' if it has no buttons), and override default editor settings.

Bottom line, having to modify library files (including config files) is something we want to avoid in favor of a GUI so non-coders can configure the editors as well. A coder does have to write the initial hook implementation, but that can be shared with and reused by everyone else so it only has to be done once. We're not there yet when it comes to the actual GUI, but that is to be fixed with Wysiwyg 3.x where the hook implementations will also be able to extend the GUI/profile form.

kaakuu’s picture

Thanks TwoD, I am trying to understand what I am supposed. And should I discard the present version and install the dev ?

People will need one or two extra FCK (or TinyMCE) module every now and then and Wysiwyg, to be even experimentally successful and to have a beginning step to wide adoption this procedure (of adding plugins) need to be very easy and somewhat non-geeky like not having to handle api files.

twod’s picture

You can use the 2.0 version, it has the same capabilities to handle plugins for FCKeditor, but the documentation is better in the -dev.

Basically, you create a small custom module which only has the purpose of telling Wysiwyg module where the plugin file can be found, which buttons it has and what settings it uses. No other file modifications are required for most plugins. Without this information, there is no way for Wysiwyg module to let you enable the plugin under 'Buttons and plugins' on the profile page.
In the .module file you put a hook implementation like this:

// Modified example from wysiwyg.api.php

/**
 * Return an array of native editor plugins.
 *
 * Only to be used for native (internal) editor plugins.
 *
 * @see hook_wysiwyg_include_directory()
 *
 * @param $editor
 *   The internal name of the currently processed editor.
 * @param $version
 *   The version of the currently processed editor.
 *
 * @return
 *   An associative array having internal plugin names as keys and an array of
 *   plugin meta-information as values.
 */
function MyModuleName_wysiwyg_plugin($editor, $version) {
  switch ($editor) {
    case 'fckeditor': // You can use the same hook implementation to provide plugins for multiple editors at the same time.
        return array(
          'indicime' => array( // Just make another array entry like below for each individual plugin you want to add. This key is the plugin name loaded by the editor and replaces the FCKConfig.Plugins.Add( ‘indicime’ ); part for FCKeditor.
            // A URL to the plugin's homepage.
            'url' => 'http://www.vishalon.net/IndicResources/IndicIME.aspx',
            // The full path to the native editor plugin.
            'path' => wysiwyg_get_path('fckeditor', TRUE) . 'plugins/indicime/indicime.js', // Path is off the top of my head, not verified
            // A list of buttons provided by this native plugin. The key has to
            // match the corresponding JavaScript implementation. The value is
            // is displayed on the editor configuration form only.
            'buttons' => array(
              'indicime' => t('IndicIME'), // These button names appear in the editor profile GUI when this module is enabled.
              'indicimehelp' => t('IndicIME Help'),
            ),
            // Boolean whether the editor needs to load this plugin. When TRUE,
            // the editor will automatically load the plugin based on the 'path'
            // variable provided. If FALSE, the plugin either does not need to
            // be loaded or is already loaded by something else on the page.
            // Most plugins should define TRUE here.
            'load' => TRUE,
            // Boolean whether this plugin is a native plugin, i.e. shipped with
            // the editor. Definition must be ommitted for plugins provided by
            // other modules.
            'internal' => TRUE,
          ),
        );
      break;
  }
}