Changeset 712

Show
Ignore:
Timestamp:
2007-08-23 11:22:52 (3 years ago)
Author:
martinkou
Message:

Fix for #212 : Made the "Show Blocks" state persistent across Source/WYSIWYG mode switches.
Fix for #212 : Added FCKConfig.StartupShowBlocks option.

Location:
FCKeditor/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/commandclasses/fckshowblocks.js

    r706 r712  
    2222 */ 
    2323 
    24 var FCKShowBlockCommand = function( name ) 
     24var FCKShowBlockCommand = function( name, defaultState ) 
    2525{ 
    2626        this.Name = name ; 
     27        if ( defaultState != undefined ) 
     28                this._SavedState = defaultState ; 
     29        else 
     30                this._SavedState = null ; 
    2731} 
    2832 
     
    6064        return FCK_TRISTATE_OFF ; 
    6165} 
     66 
     67FCKShowBlockCommand.prototype.SaveState = function() 
     68{ 
     69        this._SavedState = this.GetState() ; 
     70} 
     71 
     72FCKShowBlockCommand.prototype.RestoreState = function() 
     73{ 
     74        if ( this._SavedState != null && this.GetState() != this._SavedState ) 
     75                this.Execute() ; 
     76} 
  • FCKeditor/trunk/editor/_source/internals/fckcommands.js

    r701 r712  
    116116                case 'InsertOrderedList' : oCommand = new FCKListCommand( 'insertorderedlist' ) ; break ; 
    117117                case 'InsertUnorderedList' : oCommand = new FCKListCommand( 'insertunorderedlist' ) ; break ; 
    118                 case 'ShowBlocks' : oCommand = new FCKShowBlockCommand( 'ShowBlocks' ) ; break ; 
     118                case 'ShowBlocks' : oCommand = new FCKShowBlockCommand( 'ShowBlocks', FCKConfig.StartupShowBlocks ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ) ; break ; 
    119119 
    120120                // Generic Undefined command (usually used when a command is under development). 
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r703 r712  
    550550                if ( bIsWysiwyg ) 
    551551                { 
     552                        FCKCommands.GetCommand( 'ShowBlocks' ).SaveState() ; 
    552553                        if ( !noUndo && FCKBrowserInfo.IsIE ) 
    553554                                FCKUndo.SaveUndoStep() ; 
     
    813814        FCK.OnAfterSetHTML() ; 
    814815 
     816        // Restore show blocks status. 
     817        FCKCommands.GetCommand( 'ShowBlocks' ).RestoreState() ; 
     818 
    815819        // Check if it is not a startup call, otherwise complete the startup. 
    816820        if ( FCK.Status != FCK_STATUS_NOTLOADED ) 
  • FCKeditor/trunk/fckconfig.js

    r701 r712  
    3939 
    4040FCKConfig.FullPage = false ; 
     41 
     42// The following option determines whether the "Show Blocks" feature is enabled or not at startup. 
     43FCKConfig.StartupShowBlocks = false ; 
    4144 
    4245FCKConfig.Debug = false ;