Opened 16 years ago
Closed 16 years ago
#3925 closed Bug (fixed)
FCKDialog.OpenDialog() - wrong variable mapping (parentWindow)
| Reported by: | Ivan Tcholakov | Owned by: | Martin Kou |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | UI : Dialogs | Version: | FCKeditor 2.6.4 |
| Keywords: | Confirmed Review+ | Cc: |
Description
FCKEditor 2.6.4 This is not a "theoretical" note, I found this bug during development of something.
See .../_source/internals/fckdialog.js
The parameter *parentWindow* in the function OpenDialog() declaration and and the variable *topWindow* that sets a property of the dialogInfo object are the same thing actually. Only one should stay - parentWindow or topWindow.
Here is an example for a correction:
var FCKDialog = ( function()
{
...
return {
/**
* Opens a dialog window using the standard dialog template.
*/
OpenDialog : function( dialogName, dialogTitle, dialogPage, width, height, customValue, parentWindow, resizable )
{
...
// Setup the dialog info to be passed to the dialog.
var dialogInfo =
{
Title : dialogTitle,
Page : dialogPage,
Editor : window,
CustomValue : customValue, // Optional
// -------------- A correction starts here ---------------------
//TopWindow : topWindow // Wrong
TopWindow : parentWindow // Correct
// -------------------------------------------------------------
}
...
},
...
Attachments (2)
Change History (10)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
| Owner: | set to Martin Kou |
|---|---|
| Status: | new → assigned |
The parentWindow argument is actually useless - if you need access to the parent dialog's window, use
ParentDialog().contentWindow
instead.
Changed 16 years ago by
| Attachment: | 3925.patch added |
|---|
comment:3 Changed 16 years ago by
| Keywords: | Review? added |
|---|
Proposed patch to remove parentWindow reference to reduce code size and avoid confusion.
comment:4 Changed 16 years ago by
Thank you, martinkou. Your suggestion works.
I had a look at your patch. I think, there is one place that was missed to be updated:
File: fckeditor/editor/_source/commandclasses/fck_othercommands.js Line 189: FCKDialog.OpenDialog( 'FCKDialog_Source', FCKLang.Source, 'dialog/fck_source.html', iWidth, iHeight, null, null, true ) ;
Changed 16 years ago by
| Attachment: | 3925_2.patch added |
|---|
comment:6 Changed 16 years ago by
| Keywords: | Confirmed added |
|---|---|
| Milestone: | FCKeditor 2.6.5 |
comment:7 Changed 16 years ago by
| Keywords: | Review+ added; Review? removed |
|---|
comment:8 Changed 16 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixed with [3975].
Click here for more info about our SVN system.

My Previous correction was wrong, topWindow and parentWindow are not the same. But anyway I need to access parrentWindow when I close a dialog. Here is another modification that works fine for me:
var FCKDialog = ( function() { ... return { /** * Opens a dialog window using the standard dialog template. */ OpenDialog : function( dialogName, dialogTitle, dialogPage, width, height, customValue, parentWindow, resizable ) { ... // Setup the dialog info to be passed to the dialog. var dialogInfo = { Title : dialogTitle, Page : dialogPage, Editor : window, CustomValue : customValue, // Optional TopWindow : topWindow, ParentWindow : parentWindow // <----------- Added property } ... }, ...