Changeset 1232

Show
Ignore:
Timestamp:
2007-12-20 10:58:24 (8 months ago)
Author:
martinkou
Message:

Reverted [1230] because a simpler approach was discovered after discussing with Fred.

Location:
FCKeditor/branches/features/floating_dialog/editor
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/floating_dialog/editor/fckdialog.html

    r1231 r1232  
    640640 
    641641/** 
    642   * Steals selection from the editor window after running EnsureSelection(). 
    643   */ 
    644 function StealSelection() 
    645 { 
    646         var dummy = document.createElement( 'textarea' ) ; 
    647         dummy.value = dummy.name = 'dummy' ; 
    648         FCKDomTools.SetElementStyles( dummy, 
    649                 { 
    650                         'position' : 'absolute', 
    651                         'left' : '-10000px', 
    652                         'top' : '-10000px', 
    653                         'zIndex' : 10000 
    654                 } ) ; 
    655         document.body.appendChild( dummy ) ; 
    656  
    657         var removeDummy = function() 
    658         { 
    659                 dummy.parentNode.removeChild( dummy ) ; 
    660         } 
    661  
    662         var stealFocus = function() 
    663         { 
    664                 dummy.focus() ; 
    665                 if ( dummy.setSelectionRange ) 
    666                         dummy.setSelectionRange( 0, 0 ) ; 
    667                 else 
    668                         dummy.createTextRange().select() ; 
    669                 setTimeout( removeDummy, 1 ) ; 
    670         } 
    671         setTimeout( stealFocus, 1 ) ; 
    672 } 
    673  
    674 /** 
    675642 * Get the FCKSelection object for the editor instance. 
    676643 */ 
     
    678645{ 
    679646        EnsureSelection() ; 
    680         var retval = FCK.Selection ; 
    681         StealSelection() ; 
    682         return retval ; 
     647        return FCK.Selection ; 
    683648} 
    684649 
  • FCKeditor/branches/features/floating_dialog/editor/plugins/placeholder/fck_placeholder.html

    r1230 r1232  
    2929                <script language="javascript"> 
    3030 
    31 var dialog = window.parent ; 
    3231var oEditor = window.parent.InnerDialogLoaded() ; 
    3332var FCKLang = oEditor.FCKLang ; 
     
    4544} 
    4645 
    47 var eSelected = dialog.GetSelection().GetSelectedElement() ; 
     46var eSelected = oEditor.FCKSelection.GetSelectedElement() ; 
    4847 
    4948function LoadSelected() 
  • FCKeditor/branches/features/floating_dialog/editor/_source/internals/fckdialog.js

    r1231 r1232  
    126126                        } 
    127127 
    128                         // Steal the focus from the editor. 
    129                         var knapsack = topDocument.createElement( 'textarea' ) ; 
    130                         knapsack.value = knapsack.name = '_FCK_Dummy' ; 
    131                         FCKDomTools.SetElementStyles( knapsack, 
    132                                 { 
    133                                         'position' : 'absolute', 
    134                                         'top' : '-1000px', 
    135                                         'left' : '-1000px', 
    136                                         'zIndex' : 100000 
    137                                 } ) ; 
    138                         topDocument.body.appendChild( knapsack ) ; 
    139  
    140                         var createDialog = function() 
    141                         { 
    142                                 // Destroy the text area used for stealing focus. 
    143                                 knapsack.parentNode.removeChild( knapsack ) ; 
    144  
    145                                 // Calculate the dialog position, centering it on the screen. 
    146                                 var viewSize = FCKTools.GetViewPaneSize( topWindow ) ; 
    147                                 var scrollPosition = FCKTools.GetScrollPosition( topWindow ) ; 
    148                                 var iTop  = Math.max( scrollPosition.Y + ( viewSize.Height - height - 20 ) / 2, 0 ) ; 
    149                                 var iLeft = Math.max( scrollPosition.X + ( viewSize.Width - width - 20 )  / 2, 0 ) ; 
    150  
    151                                 // Setup the IFRAME that will hold the dialog. 
    152                                 var dialog = topDocument.createElement( 'iframe' ) ; 
    153                                 dialog.src = FCKConfig.BasePath + 'fckdialog.html' ; 
    154                                 dialog.frameBorder = 0 ; 
    155                                 dialog.allowTransparency = true ; 
    156                                 FCKDomTools.SetElementStyles( dialog, 
    157                                                 { 
    158                                                         'position'      : 'absolute', 
    159                                                         'top'           : iTop + 'px', 
    160                                                         'left'          : iLeft + 'px', 
    161                                                         'width'         : width + 'px', 
    162                                                         'height'        : height + 'px', 
    163                                                         'zIndex'        : getZIndex() 
    164                                                 } ) ; 
    165  
    166                                 // Save the dialog info to be used by the dialog page once loaded. 
    167                                 dialog._DialogArguments = dialogInfo ; 
    168  
    169                                 // Append the IFRAME to the target document. 
    170                                 topDocument.body.appendChild( dialog ) ; 
    171  
    172                                 // Keep record of the dialog's parent/child relationships. 
    173                                 dialog._ParentDialog = topDialog ; 
    174                                 topDialog = dialog ; 
    175                         } 
    176                          
    177                         var stealFocus = function() 
    178                         { 
    179                                 knapsack.focus() ; 
    180                                 if ( knapsack.setSelectionRange ) 
    181                                         knapsack.setSelectionRange( 0, 0 ) ; 
    182                                 else 
    183                                         knapsack.createTextRange().select() ; 
    184                                 setTimeout( createDialog, 1 ) ; 
    185                         } 
    186  
    187                         setTimeout( stealFocus, 1 ) ; 
     128                        // Calculate the dialog position, centering it on the screen. 
     129                        var viewSize = FCKTools.GetViewPaneSize( topWindow ) ; 
     130                        var scrollPosition = FCKTools.GetScrollPosition( topWindow ) ; 
     131                        var iTop  = Math.max( scrollPosition.Y + ( viewSize.Height - height - 20 ) / 2, 0 ) ; 
     132                        var iLeft = Math.max( scrollPosition.X + ( viewSize.Width - width - 20 )  / 2, 0 ) ; 
     133 
     134                        // Setup the IFRAME that will hold the dialog. 
     135                        var dialog = topDocument.createElement( 'iframe' ) ; 
     136                        dialog.src = FCKConfig.BasePath + 'fckdialog.html' ; 
     137                        dialog.frameBorder = 0 ; 
     138                        dialog.allowTransparency = true ; 
     139                        FCKDomTools.SetElementStyles( dialog, 
     140                                        { 
     141                                                'position'      : 'absolute', 
     142                                                'top'           : iTop + 'px', 
     143                                                'left'          : iLeft + 'px', 
     144                                                'width'         : width + 'px', 
     145                                                'height'        : height + 'px', 
     146                                                'zIndex'        : getZIndex() 
     147                                        } ) ; 
     148 
     149                        // Save the dialog info to be used by the dialog page once loaded. 
     150                        dialog._DialogArguments = dialogInfo ; 
     151 
     152                        // Append the IFRAME to the target document. 
     153                        topDocument.body.appendChild( dialog ) ; 
     154 
     155                        // Keep record of the dialog's parent/child relationships. 
     156                        dialog._ParentDialog = topDialog ; 
     157                        topDialog = dialog ; 
    188158                }, 
    189159