Does this module have a plugin API or some way to develop other modules that add additional functionality? May want to see if WYSIWYG - GeSHi bridge can also work with this module.

I poked around this module's source code and didn't see anything.


okeedoak’s picture

Others have added functionality so there must be a way:

Aren Cambre’s picture

No, I am talking about the actual Drupal module's extensibility. Is this documented? See for a comparison.

jcisio’s picture

You can add plugin by using this module.

The module doesn't provide plugin API because the editor (CKEditor) itself has API features. See the plugins (of both the module and the editor) for more information. You can read CKEditor documentation for plugin development (but I admit that CKEditor 3.x is lacks of dev documentation).

Example is #721914: Opening IMCE window without Image Dialog

jcisio’s picture

Status:Active» Fixed

Forgot to mark as fixed ;)

Aren Cambre’s picture

Status:Fixed» Active

So you're saying all plugins are folded into the master module? I'm looking to create a module that handles a niche situation--CKEditor integration with GeSHi filter. Not sure that makes sense folded into CKEditor - WYSIWYG HTML editor?

mephir’s picture

Category:support» feature

No, module don't have any api, but i think it is good point to discuss about it.

wwalc’s picture

Category:feature» support
Status:Active» Fixed

The original question was about whether it's possible to interact with CKEditor module from another Drupal module, so I believe that was not exactly the full answer that Aren Combre expected.

The real answer is that I didn't want to compete with Wysiwyg module in this area, so current API is very simple and just allows anyone to insert HTML into the editor using the Drupal.ckeditorInsertHtml function (this is the most common use case, however if there will be demand for something else, like registering extra plugins via php, we may consider enhancing it).

Things like adding an extra configuration option to CKEditor when a compatible module is available are right now done inside of the CKEditor module (i.e. enabling IMCE).

If someone wants to provide an extra plugin for CKEditor, at this moment this can be done by instructing users to add extra configuration options to modules/ckeditor/ckeditor.config.js, this is one extra step comparing to Wysiwyg module.

I've just check the source code of the WYSIWYG - GeSHi bridge module and if I'm not wrong, it's just a pure CKEditor plugin, so it's already compatible with the CKEditor module, it just needs to be enabled.

In Wysiwyg, the installation looks more or less like this:
- install WYSIWYG - GeSHi bridge module
- check CKEditor settings and enable buttons there (let's forget for a while that the toolbar will be messed up)

In CKEditor module
- because it's a pure CKEditor plugin there is actually no need to install an extra module
- (optional) copy juest the CKEditor plugin to a plugins folder (or leave it in modules/wysiwyg-geshi, makes no difference)
- add in ckeditor.config.js:
* registering plugin in config.extraPlugins
* loading plugin with CKEDITOR.plugins.addExternal
* add Geshi-* buttons to selected toolbars

Pros of the Wysiwyg module: possibly easier installation. Pros of the CKEditor module: one module less, better control over the toolbar.

I have to go now, but I can get back to this later and let you know what exactly configuration options have to be added to ckeditor.config.js to enable your module inside of CKEditor, this way you could add for example a short readme on how to use your module along with CKEditor module.

wwalc’s picture

Status:Fixed» Active

// Setting back issue status to active

Aren Cambre’s picture

Thank you!

wwalc’s picture

I've just checked the wysiwyg-geshi module, the integration with CKEditor module is not hard (but could be easier):

In ckeditor.config.js add something like:

config.extraPlugins += (config.extraPlugins ? ',geshi' : 'geshi' );
CKEDITOR.plugins.addExternal('geshi', Drupal.settings.basePath + 'sites/all/modules/wysiwyg-geshi/ckeditor/');

and add selected buttons (Geshi-code, Geshi-php, ...) to selected toolbars.

For example, in Filtered and Full toolbars, there is a set of buttons:

['DrupalBreak', 'DrupalPageBreak']

You can add them at the end of the toolbar:

['DrupalBreak', 'DrupalPageBreak','Geshi-code','Geshi-php']

Regarding the CKEditor plugin - I saw that there are no icons. To add an icon to a button, specify the "icon" attribute, for example:

editor.ui.addButton( buttonName,
label : buttonLabel,
icon : plugin.path + 'images/' + buttonLabel + '.gif',
command : commandName

where the "plugin" variable is defined at the beginning of the init function with:

init : function( editor )
var plugin = this;
// All buttons use the same code to register. So, to avoid
Aren Cambre’s picture

Thanks. I was hoping there was a more of an API-based method that doesn't require customizations of your module.

Aren Cambre’s picture

Title:Does this module have a plugin API?» Add plugin API
Category:support» feature
iamjon’s picture

You can copy the config file into your theme and do it from there

jcisio’s picture

Title:Add plugin API» Relation between plugins and toolbar buttons

I was thinking a little bit and here is a method to provide plugin for CKEditor.

There are a few ways to add a plugin, from simple to more complex one:
- Administrator enters those values manually (for plugin that does not exist on, or simple plugin that does not want a .module or .info file).
- Module implements hook_ckeditor_plugin and returns an array of $plugin = array('path' => 'path/to/plugin.js', 'buttons' => array('btn1', 'btn2'...));
- User ctools plugin mechanism.

One the relation between buttons and plugin is defined, plugins are loaded based on the toolbar settings. There are a few level of performance optimization, too:
- Create an aggregated .js file for the editor and plugins (think about situation when we don't change toolbar on-the-fly)
- Create an aggregated .js file for the editor (loader, editor, language), an aggregated .js file for each toolbar settings.
- No aggregation (as in the current implementation)

dczepierga’s picture

Status:Active» Closed (fixed)

In the last DEV version we add hook to integrate with CKEditor module - everything is here: #1179912: [D6] Add hook to register plugin

I think now we can close this issue.