Closed (fixed)
Project:
CKEditor 4 - WYSIWYG HTML editor
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Sep 2011 at 15:52 UTC
Updated:
16 Jul 2012 at 13:05 UTC
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.
| Comment | File | Size | Author |
|---|---|---|---|
| Schermafdruk op 2011-09-27 17:50:20.png | 10.19 KB | open social |
Comments
Comment #1
open social commentedI 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.
Comment #2
dczepierga commentedHi,
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
Comment #3
open social commentedOk, 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?
Comment #4
dczepierga commentedI 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...
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
Comment #5
open social commentedDoes this mean the button will automatically be added to the ckeditor without selecting it at the ckeditor admin interface?
Comment #6
dczepierga commentedNo, 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
Comment #7
dczepierga commentedNo, 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
Comment #8
open social commentedOk thanks!
Got it working now,
Thank you for your help.
Greetings Daniel
Comment #9
dczepierga commentedOk no problem. I'm really happy i could help u :)
Greetings
Comment #11
anil_89 commenteddoes not called