Changeset 1124

Show
Ignore:
Timestamp:
2007-11-27 15:12:00 (2 years ago)
Author:
fredck
Message:

Fixed #1462 : The enter key will not any more scroll the main window. We are not using a custom implementation of scrollIntoView for Safari only.

Location:
FCKeditor/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/fck_replace.html

    r1108 r1124  
    351351                while ( focus && focus.nodeType != 1 ) 
    352352                        focus = focus.parentNode ; 
     353 
    353354                if ( focus ) 
    354                 focus.scrollIntoView( false ) ; 
     355                { 
     356                        if ( oEditor.FCKBrowserInfo.IsSafari ) 
     357                                oEditor.FCKDomTools.ScrollIntoView( focus, false ) ; 
     358                        else 
     359                                focus.scrollIntoView( false ) ; 
     360                } 
     361 
    355362                return true; 
    356363        } 
  • FCKeditor/trunk/editor/_source/classes/fckenterkey.js

    r1083 r1124  
    493493                        oRange.MoveToElementEditStart( bIsStartOfBlock && !bIsEndOfBlock ? eNextBlock : eNewBlock ) ; 
    494494 
    495                         if ( FCKBrowserInfo.IsGeckoLike ) 
     495                        if ( FCKBrowserInfo.IsSafari ) 
     496                                FCKDomTools.ScrollIntoView( eNewBlock, false ) ; 
     497                        else if ( FCKBrowserInfo.IsGeckoLike ) 
    496498                                eNewBlock.scrollIntoView( false ) ; 
    497499                } 
     
    575577                                else 
    576578                                        dummy = this.Window.document.createElement( 'br' ) ; 
     579 
    577580                                eLineBreak.parentNode.insertBefore( dummy, eLineBreak.nextSibling ) ; 
    578                                 dummy.scrollIntoView( false ) ; 
     581 
     582                                if ( FCKBrowserInfo.IsSafari ) 
     583                                        FCKDomTools.ScrollIntoView( dummy, false ) ; 
     584                                else 
     585                                        dummy.scrollIntoView( false ) ; 
     586 
    579587                                dummy.parentNode.removeChild( dummy ) ; 
    580588                        } 
  • FCKeditor/trunk/editor/_source/internals/fckdomtools.js

    r1089 r1124  
    254254                                if ( ignoreElements && currentNode.nodeName.IEquals( ignoreElements ) ) 
    255255                                        return this.GetNextSourceElement( currentNode, ignoreSpaceTextOnly, stopSearchElements, ignoreElements ) ; 
    256                                  
     256 
    257257                                return currentNode ; 
    258258                        } 
     
    315315                                return this.GetPreviousSourceNode( currentNode.parentNode, true, nodeType, stopSearchNode ) ; 
    316316                } 
    317                  
     317 
    318318                if ( nodeType && node && node.nodeType != nodeType ) 
    319319                        return this.GetPreviousSourceNode( node, false, nodeType, stopSearchNode ) ; 
     
    940940                } 
    941941                return null ; 
     942        }, 
     943 
     944        /** 
     945         * Current implementation for ScrollIntoView (due to #1462). We don't have 
     946         * a complete implementation here, just the things that fit our needs. 
     947         */ 
     948        ScrollIntoView : function( element, alignTop ) 
     949        { 
     950                // Get the element window. 
     951                var window = FCKTools.GetElementWindow( element ) ; 
     952                var windowHeight = FCKTools.GetViewPaneSize( window ).Height ; 
     953                 
     954                // Starts the offset that will be scrolled with the negative value of 
     955                // the visible window height. 
     956                var offset = windowHeight * -1 ; 
     957 
     958                // Appends the height it we are about to align the bottoms. 
     959                if ( alignTop === false ) 
     960                { 
     961                        offset += element.offsetHeight ; 
     962                         
     963                        // Consider the margin in the scroll, which is ok for our current 
     964                        // needs, but needs investigation if we will be using this function 
     965                        // in other places. 
     966                        offset += parseInt( this.GetCurrentElementStyle( window, element, 'marginBottom' ) || 0, 10 ) ; 
     967                } 
     968 
     969                // Appends the offsets for the entire element hierarchy. 
     970                offset += element.offsetTop ; 
     971                while ( ( element = element.parentNode ) ) 
     972                        offset += element.offsetTop || 0 ; 
     973                 
     974                // Scroll the window to the desired position, if not already visible. 
     975                var currentScroll = FCKTools.GetScrollPosition( window ).Y ; 
     976                if ( offset > 0 && offset > currentScroll ) 
     977                        window.scrollTo( 0, offset ) ; 
    942978        } 
    943979} ; 
  • FCKeditor/trunk/_whatsnew.html

    r1120 r1124  
    132132                                        and "More colors..." buttons were improperly styled in the color selector panels 
    133133                                        (Opera too).</li> 
     134                                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1462">#1462</a>] The enter 
     135                                        key will not any more scroll the main window.</li> 
    134136                        </ul> 
    135137                </li> 
    136                 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1562">#1562</a>] Fixed the issue where empty paragraphs 
    137                         are added around page breaks each time the user switches to Source mode.</li> 
     138                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1562">#1562</a>] Fixed 
     139                        the issue where empty paragraphs are added around page breaks each time the user 
     140                        switches to Source mode.</li> 
    138141        </ul> 
    139142        <h3>