Changeset 1602

Show
Ignore:
Timestamp:
2008-02-24 16:52:48 (4 months ago)
Author:
alfonsoml
Message:

Add a "customData" parameter to the menu creation. #958

Location:
FCKeditor/trunk
Files:
5 modified

Legend:

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

    r1598 r1602  
    5858} 
    5959 
    60 FCKContextMenu.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) 
    61 { 
    62         var oItem = this._MenuBlock.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled) ; 
     60/** 
     61 The customData parameter is just a value that will be send to the command that is executed,  
     62 so it's possible to reuse the same command for several items just by assigning different data for each one. 
     63*/ 
     64FCKContextMenu.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) 
     65{ 
     66        var oItem = this._MenuBlock.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) ; 
    6367        this._Redraw = true ; 
    6468        return oItem ; 
  • FCKeditor/trunk/editor/_source/classes/fckmenublock.js

    r1565 r1602  
    3434} 
    3535 
    36 FCKMenuBlock.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) 
     36FCKMenuBlock.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) 
    3737{ 
    38         var oItem = new FCKMenuItem( this, name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) ; 
     38        var oItem = new FCKMenuItem( this, name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) ; 
    3939 
    4040        oItem.OnClick           = FCKTools.CreateEventListener( FCKMenuBlock_Item_OnClick, this ) ; 
  • FCKeditor/trunk/editor/_source/classes/fckmenuitem.js

    r1565 r1602  
    2222 */ 
    2323 
    24 var FCKMenuItem = function( parentMenuBlock, name, label, iconPathOrStripInfoArray, isDisabled ) 
     24var FCKMenuItem = function( parentMenuBlock, name, label, iconPathOrStripInfoArray, isDisabled, customData ) 
    2525{ 
    2626        this.Name               = name ; 
     
    3333        this.SubMenu.Parent             = parentMenuBlock ; 
    3434        this.SubMenu.OnClick    = FCKTools.CreateEventListener( FCKMenuItem_SubMenu_OnClick, this ) ; 
     35        this.CustomData = customData ; 
    3536 
    3637        if ( FCK.IECleanup ) 
     
    4041FCKMenuItem.prototype.TypeName = 'FCKMenuItem' ;                // @Packager.RemoveLine 
    4142 
    42 FCKMenuItem.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) 
     43FCKMenuItem.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) 
    4344{ 
    4445        this.HasSubMenu = true ; 
    45         return this.SubMenu.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) ; 
     46        return this.SubMenu.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled, customData ) ; 
    4647} 
    4748 
  • FCKeditor/trunk/editor/_source/internals/fck_contextmenu.js

    r1565 r1602  
    326326{ 
    327327        FCK.Focus() ; 
    328         FCKCommands.GetCommand( item.Name ).Execute() ; 
    329 } 
     328        FCKCommands.GetCommand( item.Name ).Execute( item.CustomData ) ; 
     329} 
  • FCKeditor/trunk/_whatsnew.html

    r1598 r1602  
    139139                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1509">#1509</a>] InsertHtml() in IE will no 
    140140                        longer turn the preceding normal whitespace into &amp;nbsp;.</li> 
     141                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/958">#958</a>] The AddItem method now has an 
     142                        additional fifth parameter "customData" that will be send to the Execute method of the command for that  
     143                        menu item, allowing a single command to be used for different menu items..</li> 
    141144        </ul> 
    142145        <p>