Impact factor for posts is a measurement of importance.

Impact factor for users reflect their authority, reputation and contribution on a particular topic.

Rating reflects the quality of posts.

Rating on Voofie is not a simple average of all ratings, but a weighted average of rating, weighted by the impact factor of users who rated.

Explore exciting communities of
getting reference of richcombo from ckeditor instance
Bookmark and Share
15 Sep 10

getting reference of richcombo from ckeditor instance

Hi ;
I have developed a custom richCombo plugin for CK Editor . I am able to add static items in the init method of the plugin .
But how do I add dynamic items to the combo which I want to add once the Editor is ready . I am getting access to the editor object once it is ready but how do I access the richcombo object/ custom plugin object from the editor to manipulate its list.

George Wu (georgewu)

Avatar for georgewu
8
15 Sep 10

The simplist way is to access the functions inside the plugin directly by writting something like this:

CKEDITOR.plugins.add('someplugin',
{
init: function(editor)
{
editor.somefunction = function(){
//do something
}
}
});

Then you can access the function through editor.somefunction.

Alternatively, you can create a class for the plugin. The contextMenu plugin that comes with CKEditor is a great example for this.  Simply follow the skeleton and you can achieve what you want.


Reply

shiraz

Avatar for shiraz
0
15 Sep 10

Thanx George for your reply .

I get what you are saying is to access the editor from within the plugin .But how do I achieve something the other way around . For example in FCK editor we can get hold of a toolbar item using the following way

editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems['toolbarItem'].

Is there something similar in CKEditor

This would allow me to access one toolbar item/plugin from another toolbar item/plugin.

 


Reply

George Wu (georgewu)

Avatar for georgewu
0
16 Sep 10

Using the way I described, you can simply call something like "editorInstance.somefunction()" from elsewhere in CKEditor after the plugin has been loaded. This way is probably the simplist.

So far as I know, there is no simple way of getting a toolbar item in CKEditor.  There is several way of implementing a plugin, and if you want to access a plugin in object form, you will have to write a class for the plugin using CKEDITOR.tools.createClass.  Here's an example from contextMenu plugin to illustrate how to do it:

CKEDITOR.plugins.add( 'contextmenu',
{
requires : [ 'menu' ],

beforeInit : function( editor )
{
editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor );

editor.addCommand( 'contextMenu',
{
exec : function()
{
editor.contextMenu.show( editor.document.getBody() );
}
});
}
});

CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass(
{
$ : function( editor )
{
//constructor
},

_ :
{
//private functions
},

proto :
{
//public functions
}
});

Reply

Please login to post comment.

What is Voofie?

Voofie organizes knowledge, discovers useful resources and recognizes knowledgable users.

Bookmark your blog in Voofie to get more traffic as well as building a reputation in your field!

Explore more about it. Become a member—our FREE Registration takes just seconds.

Page Info
64Impacts
3.5/1 rate
1209
Your Rating: