Hey,

I have

/**
 * Implementation of hook_ckeditor_plugin().
 */
function cleeng_ckeditor_plugin() {
  return array('cleeng' => array(
    'name' => 'cleeng',
    'desc' => t('Cleeng - A plugin to use Cleeng with Ckeditor'),
    'path' => drupal_get_path('module', 'cleeng') .'/plugins/cleeng/',
  ));
} 

I also have this file structure.

sites/all/modules/custom/cleeng/plugins/cleeng/plugin.js

In the js file (Javascript ofcourse.. but php highlighter)

/**
 * @file Plugin for Cleeng
 */
 
CKEDITOR.plugins.add('cleeng',
{
    init: function(editor)
    {
        var pluginName = 'cleeng';
        editor.addCommand(pluginName, {exec:cleeng_onclick})        
        editor.ui.addButton(pluginName,
            {
                label: "Protect section with Cleeng",
                command: pluginName
            });
    }
});

function cleeng_onclick(e) {
	alert('test');	
}

This gives me the result of two buttons: page break and teaser break.

I think this is a bug. Looks like the hook does not find the right javascript.

Comments

open social’s picture

I want to help as much as I can, If someone has some directions to debug I will debug.

But for now I am stuck, can not find why it is going wrong.

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,
Could u try to use in editor.ui.addButton pluginName as string value?

This function parse plugin.js file to get all available buttons, where button is defined with string - we couldn't do this in other way.
I will port this new version of this hook from Drupal 7 asap and then it will be possible to define buttons without parsing plugin.js file.
So pls be patient.

Greetings

open social’s picture

Ok, no javascript erros anymore. But also no button
I will work on this today,

I am writing a module which adds a button to ckeditor and do something with the selected text. Should the button be visible after I select it in the ckeditor admin? Or do I need to edit which buttons should appear?

dczepierga’s picture

I add new version of hook to D6 DEV. Now it's possible to add manually buttons by hook:
http://drupalcode.org/project/ckeditor.git/blob/refs/heads/6.x-1.x:/incl...

function MODULENAME_ckeditor_plugin() {
  return array(
        'plugin_name' => array(
            // Plugin name.
            'name' => 'plugin_name',
            // Plugin description - it will be displayed in the plugins management section of profile settings.
            'desc' => t('Description of plugin'),
            // The full path to the CKEditor plugin directory, trailing slash included.
            'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
            // Plugin buttons definition [optional]
            'buttons' => array(
                array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
                array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
                ...
            )
        )
    );
}

If u not define buttons it would try to parse plugin.js file and detect them automatically.

If your module is enabled, the hook should be detected and then it would appear in toolbar wizard configuration (added in the last DEV version).

Greetings

open social’s picture

Does this mean the button will automatically be added to the ckeditor without selecting it at the ckeditor admin interface?

dczepierga’s picture

No, it would be visible only in CKEditor admin interface.
When u write this hook with plugin and buttons defined, u should see in ckeditor admin interface this buttons in toolbar wizard configuration.
Then u can drag&drop them to the toolbar and they appear only if u checked below your plugin to be enabled with this CKEditor profile.

Greetings

dczepierga’s picture

No, it would be visible only in CKEditor admin interface.
When u write this hook with plugin and buttons defined, u should see in ckeditor admin interface this buttons in toolbar wizard configuration.
Then u can drag&drop them to the toolbar and they appear only if u checked below your plugin to be enabled with this CKEditor profile.

Greetings

open social’s picture

Ok thanks!
Got it working now,

Thank you for your help.

Greetings Daniel

dczepierga’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok no problem. I'm really happy i could help u :)

Greetings

Status: Fixed » Closed (fixed)

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

anil_89’s picture

does not called