GetSimple Support Forum

Full Version: Filebrowser limited to one instance??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

In my plugin (MLD Newsletter) the built-in CKEditor is used twice on the same page. The filebrowser isn't working for the second instance, because the filebrowser is limited to one instance by the following code in the header:
Code:
if ($funcNum=="2"){
    if(window.opener){
            window.opener.CKEDITOR.tools.callFunction($funcNum, $url);
    }
}
The first editor has $funcNum=2, so the filebrowser works fine. The second editor has another $funcNum, so the filebrowser won't work.

Why is that? What is the reason of this limit?
If your using multiple ckeditors on the page you must use funcNum=2 as this is returned to CKeditor and it processes the selected file.

There should be no limit on the amount of editors/filebrowsers.

Are there any other JS errors..
According to the CKE documentation: (http://docs.cksource.com/CKEditor_3.x/De...le_Browser
Quote:CKEditor automatically sends some additional arguments to the file browser:
* CKEditor – name of the CKEditor instance,
* langCode – CKEditor language (en for English),
* CKEditorFuncNum – anonymous function reference number used to pass the URL of a file to CKEditor (a random number).
It is a random number, made by CKEditor for reference. The number is different because the url must be send back to the right editor instance. When both editors have the same id, the filebrowser doesn't know which editor wants the url.

I can be wrong of course, but this is how I understand the documentation.

EDIT: no other JS errors
Oh right, always thought it was funcnum=2 ckeditor.
Which we have hardcoded into the filebrowser code.

I've updated the latest version on the SVN to fix this problem.

Will try and get this release updated in the next day or two...


Thanks for finding....
Tested and now it works as it should. Thanks.