Ben
Ben

Reputation: 257

How to use CKEDITOR.tools.callFunction for specific instance

I can use this code:

var OriginalFunction = CKEDITOR.tools.callFunction;
CKEDITOR.tools.callFunction=function(n,x)
{
  OriginalFunction(n, x);
  alert("Called From New function");
}

To add a javascript function beside the regular function of he CKeditor toolbar buttons. but i need to be able to add to a specific editor instance. so i tried:

var OriginalFunction = CKEDITOR.instances.editor1.tools.callFunction;
CKEDITOR.instances.editor1.tools.callFunction=function(n,x)
{
  OriginalFunction(n, x);
  alert("Called From New function");
}

But then the function i add don't work. is there another way to do that?

Thanks.

Upvotes: 0

Views: 2262

Answers (1)

AlfonsoML
AlfonsoML

Reputation: 12690

You should get an error (not "doesn't work" but a javascript error) because tools isn't a member of the editor instance.

You might want to use the afterCommandExec event instead.

Upvotes: 2

Related Questions