views:

126

answers:

2

I've built a simple CKeditor 3 plugin with one button that should just call a JS-function when somebody clicks it.

The plugin (code when somebody clicks) looks like this and is working:

var openAssetsBrowser = {
    exec:function(editor){
        openAssetsBrowser();
    }
};

I always get the error "openAssetsBrowser is not a function"

The function itself is somewhere in the page, I thought the order shouldn't matter since the whole page is read first, before anyone would lclick the ckeditor button that triggers the function

Calling it on a link somewhere (e.g. with jquery) in the page just works:

$("a#linkOpenFileManager").click(function(){
    openAssetsBrowser();        
        return(false);      
});

Does anyone know why the function cannot be called from within the CKeditor plugin?

update: when pasting the complete function code instead of "openAssetsBrowser();" in the plugin, all works, but that's not really re-usable code...

A: 

now that was easy.

parent.openAssetsBrowser() did the trick!

Jorre
A: 

Do you have some more explained codes, on where did you actually changed files? I am trying to achieve the same, I need a simple button which calls a function from the parent window, but I can't find any full code related to it. Thanks.

Paul