Changeset 1434

Show
Ignore:
Timestamp:
2008-01-28 03:47:17 (2 years ago)
Author:
martinkou
Message:

Fixed #1514 : Floating panels attached to a shared toolbar among multiple FCKeditor instances are no longer misplaced when the editing areas are absolutely or relatively positioned.

Location:
FCKeditor/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/classes/fckpanel.js

    r1387 r1434  
    6565                        } ) ; 
    6666 
    67                 if ( this._Window == window.parent && window.frameElement ) 
    68                 { 
    69                         var scrollPos = null ; 
    70                         if ( FCKBrowserInfo.IsGecko && FCK && FCK.EditorDocument ) 
    71                                 scrollPos = [ FCK.EditorDocument.body.scrollLeft, FCK.EditorDocument.body.scrollTop ] ; 
    72                         window.frameElement.parentNode.insertBefore( oIFrame, window.frameElement ) ; 
    73                         if ( scrollPos ) 
    74                         { 
    75                                 var restoreFunc = function() 
    76                                 { 
    77                                         FCK.EditorDocument.body.scrollLeft = scrollPos[0] ; 
    78                                         FCK.EditorDocument.body.scrollTop = scrollPos[1] ; 
    79                                 } 
    80                                 setTimeout( restoreFunc, 500 ) ; 
    81                         } 
    82                 } 
    83                 else 
    84                         this._Window.document.body.appendChild( oIFrame ) ; 
     67                this._Window.document.body.appendChild( oIFrame ) ; 
    8568 
    8669                var oIFrameWindow = oIFrame.contentWindow ; 
     
    196179 
    197180                // Be sure we'll not have more than one Panel opened at the same time. 
    198                 if ( FCKPanel._OpenedPanel ) 
    199                         FCKPanel._OpenedPanel.Hide() ; 
     181                // Do not unlock focus manager here because we're displaying another floating panel 
     182                // instead of returning the editor to a "no panel" state (Bug #1514). 
     183                if ( FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel &&  
     184                                FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel != this ) 
     185                        FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel.Hide( false, true ) ; 
    200186 
    201187                FCKDomTools.SetElementStyles( eMainNode, 
     
    262248                } 
    263249 
    264                 if ( x < 0 ) 
    265                          x = 0 ; 
    266  
    267250                // Set the context menu DIV in the specified location. 
    268251                FCKDomTools.SetElementStyles( this._IFrame, 
     
    272255                        } ) ; 
    273256 
    274                 var iWidth      = iMainWidth ; 
    275                 var iHeight     = eMainNode.offsetHeight ; 
    276  
    277                 this._IFrame.width      = iWidth ; 
    278                 this._IFrame.height = iHeight ; 
    279  
    280                 // Move the focus to the IFRAME so we catch the "onblur". 
    281                 this._IFrame.contentWindow.focus() ; 
    282  
    283                 FCKPanel._OpenedPanel = this ; 
    284         } 
    285  
    286         this._IsOpened = true ; 
     257                var me = this ; 
     258                var resizeFunc = function() 
     259                { 
     260                        var iWidth = eMainNode.offsetWidth || eMainNode.firstChild.offsetWidth ; 
     261                        var iHeight = eMainNode.offsetHeight ; 
     262                        me._IFrame.width = iWidth ; 
     263                        me._IFrame.height = iHeight ; 
     264                 
     265                        // Move the focus to the IFRAME so we catch the "onblur". 
     266                        me._IFrame.contentWindow.focus() ; 
     267                        me._IsOpened = true ; 
     268                } 
     269                setTimeout( resizeFunc, 1 ) ; 
     270 
     271                FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel = this ; 
     272        } 
    287273 
    288274        FCKTools.RunFunction( this.OnShow, this ) ; 
    289275} 
    290276 
    291 FCKPanel.prototype.Hide = function( ignoreOnHide ) 
     277FCKPanel.prototype.Hide = function( ignoreOnHide, ignoreFocusManagerUnlock ) 
    292278{ 
    293279        if ( this._Popup ) 
     
    299285 
    300286                // Enable the editor to fire the "OnBlur". 
    301                 if ( typeof( FCKFocusManager ) != 'undefined' ) 
     287                if ( typeof( FCKFocusManager ) != 'undefined' && !ignoreFocusManagerUnlock ) 
    302288                        FCKFocusManager.Unlock() ; 
    303289 
  • FCKeditor/trunk/editor/_source/classes/fcktoolbarpanelbutton.js

    r798 r1434  
    4949 
    5050        var oPanel = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName )._Panel ; 
     51        this.RegisterPanel( oPanel ) ; 
     52} 
     53 
     54FCKToolbarPanelButton.prototype.RegisterPanel = function( oPanel ) 
     55{ 
     56        if ( oPanel._FCKToolbarPanelButton ) 
     57                return ; 
     58 
    5159        oPanel._FCKToolbarPanelButton = this ; 
    5260 
     
    5563        eLineDiv.style.top = '0px' ; 
    5664 
    57         var eLine = this.LineImg = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ; 
     65        var eLine = oPanel._FCKToolbarPanelButtonLineDiv = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ; 
    5866        eLine.className = 'TB_ConnectionLine' ; 
    5967        eLine.style.position = 'absolute' ; 
     
    7583        oButton._UIButton.ChangeState( FCK_TRISTATE_ON ) ; 
    7684 
    77         oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ; 
     85        // oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ; 
    7886 
    79         FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ).Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border 
     87        var oCommand = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ) ; 
     88        var oPanel = oCommand._Panel ; 
     89        oPanel._FCKToolbarPanelButtonLineDiv.style.width = ( e.offsetWidth - 2 ) + 'px' ; 
     90        oCommand.Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border 
    8091} 
    8192 
  • FCKeditor/trunk/editor/_source/commandclasses/fcktextcolorcommand.js

    r1398 r1434  
    4343        this._Panel.MainNode.className = 'FCK_Panel' ; 
    4444        this._CreatePanelBody( this._Panel.Document, this._Panel.MainNode ) ; 
     45        FCK.ToolbarSet.ToolbarItems.GetItem( this.Name ).RegisterPanel( this._Panel ) ; 
    4546 
    4647        FCKTools.DisableSelection( this._Panel.Document.body ) ; 
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r1402 r1434  
    3333        DataProcessor   : new FCKDataProcessor(), 
    3434 
     35        GetInstanceObject       : (function() 
     36        { 
     37                var w = window ; 
     38                return function( name ) 
     39                { 
     40                        return w[name] ; 
     41                } 
     42        })(), 
     43 
    3544        AttachToOnSelectionChange : function( functionPointer ) 
    3645        { 
  • FCKeditor/trunk/editor/_source/internals/fcktoolbarset.js

    r1070 r1434  
    108108 
    109109        oToolbarSet.CurrentInstance = FCK ; 
     110        if ( !oToolbarSet.ToolbarItems ) 
     111                oToolbarSet.ToolbarItems = FCKToolbarItems ; 
    110112 
    111113        FCK.AttachToOnSelectionChange( oToolbarSet.RefreshItemsState ) ; 
  • FCKeditor/trunk/_whatsnew.html

    r1409 r1434  
    6565                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1707">#1707</a>] The editor 
    6666                        no longer hangs when operating on documents imported from Microsoft Word.</li> 
     67                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1514">#1514</a>] Floating panels 
     68                        attached to a shared toolbar among multiple FCKeditor instances are no longer misplaced 
     69                        when the editing areas are absolutely or relatively positioned.</li> 
    6770        </ul> 
    6871        <p>