0

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

How would i use it? CKEDITOR.instances.FormLinePreview.afterCommandExec(evt){ alert("Called From New function");} ?
No, this is an event so you use it like any other event: instance.on("afterCommandExec", function (evt) {})
Why doesn't it work when you press on a dropdown list option (for example 24 on the font-size list)?
Showing the contents of a dropdown list isn't executing any command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.