Changeset 410

Show
Ignore:
Timestamp:
2007-07-05 15:55:49 (3 years ago)
Author:
martinkou
Message:

Fixed #802 : Made the new replace code compatible with Internet Explorer and Opera.

Location:
FCKeditor/trunk
Files:
3 modified

Legend:

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

    r408 r410  
    3333function OnLoad() 
    3434{ 
    35         // First of all, translate the dialog box texts 
     35        // First of all, translate the dialog box texts. 
    3636        oEditor.FCKLanguageManager.TranslatePage( document ) ; 
    3737         
    3838        window.parent.SetAutoSize( true ) ; 
     39 
     40        // Place the cursor at the start of document. 
     41        // This will be the starting point of our search. 
     42        var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
     43        range.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ; 
     44        range.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ; 
     45        range.Collapse( true ) ; 
     46        range.Select() ; 
    3947} 
    4048 
     
    141149                case 0x202f: 
    142150                case 0x205f: 
    143                 case 3000: 
     151                case 0x3000: 
    144152                        return true; 
    145153                default: 
     
    177185                while ( true ) 
    178186                { 
    179                         if ( c == this.Pattern[ this._State ] ) 
     187                        if ( c == this.Pattern.charAt( this._State ) ) 
    180188                        { 
    181189                                this._State++ ; 
     
    309317                selection.Collapse( false ) ; 
    310318                selection.Select() ; 
    311                 oEditor.FCK.EditorDocument.body.normalize() ; 
    312319        } 
    313320} 
     
    317324        oEditor.FCKUndo.SaveUndoStep() ; 
    318325 
    319         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    320         range.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ; 
    321         range.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ; 
    322         range.Collapse( true ) ; 
    323         range.Select() ; 
    324326        var replaceCount = 0 ; 
    325327 
     
    335337        if ( replaceCount == 0 ) 
    336338                alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; 
    337         else 
    338                 oEditor.FCK.EditorDocument.body.normalize() ; 
    339339        window.parent.Cancel() ; 
    340340} 
  • FCKeditor/trunk/editor/_source/internals/fckundo.js

    r405 r410  
    8888        // Assume the editor content is changed when SaveUndoStep() is called after the first time. 
    8989        // This also enables the undo button in toolbar. 
    90         if ( FCKUndo.SavedData.length ) 
    91                 FCKUndo.Changed = true ; 
     90        if ( this.SavedData.length ) 
     91                this.Changed = true ; 
    9292 
    9393        // Get the HTML content. 
     
    9595 
    9696        // Shrink the array to the current level. 
    97         FCKUndo.SavedData = FCKUndo.SavedData.slice( 0, FCKUndo.CurrentIndex + 1 ) ; 
     97        this.SavedData = this.SavedData.slice( 0, this.CurrentIndex + 1 ) ; 
    9898 
    9999        // Cancel operation if the new step is identical to the previous one. 
    100         if ( FCKUndo.CurrentIndex > 0 && sHtml == FCKUndo.SavedData[ FCKUndo.CurrentIndex ][0] ) 
     100        if ( this.CurrentIndex > 0 && sHtml == this.SavedData[ this.CurrentIndex ][0] ) 
    101101                return ; 
    102102        // Save the selection and caret position in the first undo level for the first change. 
    103         else if ( FCKUndo.CurrentIndex == 0 && sHtml == FCKUndo.SavedData[0][0] ) 
     103        else if ( this.CurrentIndex == 0 && sHtml == this.SavedData[0][0] ) 
    104104        { 
    105                 FCKUndo.SavedData[0][1] = FCKUndo._GetBookmark() ; 
     105                this.SavedData[0][1] = this._GetBookmark() ; 
    106106                return ; 
    107107        } 
     
    109109        // If we reach the Maximun number of undo levels, we must remove the first 
    110110        // entry of the list shifting all elements. 
    111         if ( FCKUndo.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels ) 
    112                 FCKUndo.SavedData.shift() ; 
     111        if ( this.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels ) 
     112                this.SavedData.shift() ; 
    113113        else 
    114                 FCKUndo.CurrentIndex++ ; 
     114                this.CurrentIndex++ ; 
    115115 
    116116        // Save the new level in front of the actual position. 
    117         FCKUndo.SavedData[ FCKUndo.CurrentIndex ] = [ sHtml, FCKUndo._GetBookmark() ] ; 
     117        this.SavedData[ this.CurrentIndex ] = [ sHtml, this._GetBookmark() ] ; 
    118118 
    119119        FCK.Events.FireEvent( "OnSelectionChange" ) ; 
     
    122122FCKUndo.CheckUndoState = function() 
    123123{ 
    124         return ( FCKUndo.Changed || FCKUndo.CurrentIndex > 0 ) ; 
     124        return ( this.Changed || this.CurrentIndex > 0 ) ; 
    125125} 
    126126 
    127127FCKUndo.CheckRedoState = function() 
    128128{ 
    129         return ( FCKUndo.CurrentIndex < ( FCKUndo.SavedData.length - 1 ) ) ; 
     129        return ( this.CurrentIndex < ( this.SavedData.length - 1 ) ) ; 
    130130} 
    131131 
    132132FCKUndo.Undo = function() 
    133133{ 
    134         if ( FCKUndo.CheckUndoState() ) 
     134        if ( this.CheckUndoState() ) 
    135135        { 
    136136                // If it is the first step. 
    137                 if ( FCKUndo.CurrentIndex == ( FCKUndo.SavedData.length - 1 ) ) 
     137                if ( this.CurrentIndex == ( this.SavedData.length - 1 ) ) 
    138138                { 
    139139                        // Save the actual state for a possible "Redo" call. 
    140                         FCKUndo.SaveUndoStep() ; 
     140                        this.SaveUndoStep() ; 
    141141                } 
    142142 
    143143                // Go a step back. 
    144                 FCKUndo._ApplyUndoLevel( --FCKUndo.CurrentIndex ) ; 
     144                this._ApplyUndoLevel( --this.CurrentIndex ) ; 
    145145 
    146146                FCK.Events.FireEvent( "OnSelectionChange" ) ; 
     
    150150FCKUndo.Redo = function() 
    151151{ 
    152         if ( FCKUndo.CheckRedoState() ) 
     152        if ( this.CheckRedoState() ) 
    153153        { 
    154154                // Go a step forward. 
    155                 FCKUndo._ApplyUndoLevel( ++FCKUndo.CurrentIndex ) ; 
     155                this._ApplyUndoLevel( ++this.CurrentIndex ) ; 
    156156 
    157157                FCK.Events.FireEvent( "OnSelectionChange" ) ; 
     
    161161FCKUndo._ApplyUndoLevel = function( level ) 
    162162{ 
    163         var oData = FCKUndo.SavedData[ level ] ; 
     163        var oData = this.SavedData[ level ] ; 
    164164 
    165165        if ( !oData ) 
     
    173173 
    174174        // Restore the selection 
    175         FCKUndo._SelectBookmark( oData[1] ) ; 
     175        this._SelectBookmark( oData[1] ) ; 
    176176 
    177         FCKUndo.TypesCount = 0 ; 
    178         FCKUndo.Changed = false ; 
    179         FCKUndo.Typing = false ; 
     177        this.TypesCount = 0 ; 
     178        this.Changed = false ; 
     179        this.Typing = false ; 
    180180} 
  • FCKeditor/trunk/fckconfig.js

    r396 r410  
    3939FCKConfig.FullPage = false ; 
    4040 
    41 FCKConfig.Debug = false ; 
     41FCKConfig.Debug = true ; 
    4242FCKConfig.AllowQueryStringDebug = true ; 
    4343