Ticket #161: fckpanel-v2.3.2-AKSinha.2.js

File fckpanel-v2.3.2-AKSinha.2.js, 2.4 KB (added by Ashish Kumar Sinha <aksinha.iit@…>, 17 years ago)

FCKPanel function from fckpanel.js (v 2.3.2) : Shows the changes that I have made

Line 
1
2var FCKPanel = function( parentWindow )
3{
4        this.IsRTL                      = ( FCKLang.Dir == 'rtl' ) ;
5        this.IsContextMenu      = false ;
6        this._LockCounter       = 0 ;
7       
8        this._Window = parentWindow || window ;
9       
10        var oDocument ;
11       
12        if ( FCKBrowserInfo.IsIE )
13        {
14                // Create the Popup that will hold the panel.
15                this._Popup     = this._Window.createPopup() ;
16                oDocument = this.Document = this._Popup.document ;
17        }
18        else
19        {
20                /*
21                 * I inserted following line so that all calculations are done with
22                 * respect to the current window, that is with respect to the FCKEditor
23                 * itself. But to handle the error in the start when first panel is being
24                 * painted I have to put an 'if' statement as well.
25                 *
26                 * Now it is positioning all floating panels correctly except the context
27                 * menu (which is not unexpected)
28                 *
29                 * -Ashish Kumar Sinha <aksinha.iit@gmail.com> 
30                 */
31                 if(window.document.body != null)
32                        this._Window = window ;
33                         
34                 
35                var oIFrame = this._IFrame = this._Window.document.createElement('iframe') ; 
36                oIFrame.src                                     = 'javascript:void(0)' ;
37                oIFrame.allowTransparency       = true ;
38                oIFrame.frameBorder                     = '0' ;
39                oIFrame.scrolling                       = 'no' ;
40                oIFrame.style.position          = 'absolute';
41                oIFrame.style.zIndex            = FCKConfig.FloatingPanelsZIndex ;
42                oIFrame.width = oIFrame.height = 0 ;
43
44                if ( this._Window == window.parent && window.frameElement )
45                        window.frameElement.parentNode.insertBefore( oIFrame, window.frameElement ) ;
46                else
47                        this._Window.document.body.appendChild( oIFrame ) ;
48               
49                var oIFrameWindow = oIFrame.contentWindow ; 
50               
51                oDocument = this.Document = oIFrameWindow.document ;
52
53                // Initialize the IFRAME document body.
54                oDocument.open() ;
55                oDocument.write( '<html><head></head><body style="margin:0px;padding:0px;"><\/body><\/html>' ) ;
56                oDocument.close() ;
57
58                FCKTools.AddEventListenerEx( oIFrameWindow, 'focus', FCKPanel_Window_OnFocus, this ) ;
59                FCKTools.AddEventListenerEx( oIFrameWindow, 'blur', FCKPanel_Window_OnBlur, this ) ;
60        }
61
62        oDocument.dir = FCKLang.Dir ;
63       
64        oDocument.oncontextmenu = FCKTools.CancelEvent ;
65
66
67        // Create the main DIV that is used as the panel base.
68        this.MainNode = oDocument.body.appendChild( oDocument.createElement('DIV') ) ;
69
70        // The "float" property must be set so Firefox calculates the size correcly.
71        this.MainNode.style.cssFloat = this.IsRTL ? 'right' : 'left' ;
72
73        if ( FCK.IECleanup )
74                FCK.IECleanup.AddItem( this, FCKPanel_Cleanup ) ;
75}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy