Posts: 66
Threads: 6
Joined: Feb 2011
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?
Posts: 1,108
Threads: 70
Joined: Aug 2009
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..
Posts: 66
Threads: 6
Joined: Feb 2011
2012-05-30, 18:54:43
(This post was last modified: 2012-05-30, 18:55:05 by Chuck Brown.)
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
Posts: 1,108
Threads: 70
Joined: Aug 2009
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....
Posts: 66
Threads: 6
Joined: Feb 2011
Tested and now it works as it should. Thanks.