hi there. I have tryed the sample 6 and customized the hole thing a little bit to create on a diffrent tag a new menu entry. the problem is that its doesn't seemed to work with other tags than the image tag. I always get a undefined when I alert the tagName in the AddItems method. Whats wrong there ?
Lg Thomas
Lg Thomas
var oMyCMCommand = new Object() ; oMyCMCommand.Name = 'OpenTable' ; // This is the standard function used to execute the command (called when clicking in the context menu item). oMyCMCommand.Execute = function() { // This command is called only when an image element is selected (IMG). // Get image URL (src). var oTable = FCKSelection.GetSelectedElement(); alert(oTable) } // This is the standard function used to retrieve the command state (it could be disabled for some reason). oMyCMCommand.GetState = function() { // Let's make it always enabled. return FCK_TRISTATE_OFF ; } // ## 2. Register our custom command. FCKCommands.RegisterCommand( 'OpenTable', oMyCMCommand ) ; // ## 3. Define the context menu "listener". var oMyContextMenuListener = new Object() ; // This is the standard function called right before sowing the context menu. oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName ) { alert(tagName); // Let's show our custom option only for images. if ( tagName == 'TABLE' ) { contextMenu.AddSeparator() ; contextMenu.AddItem( 'OpenTable', 'Wrap Div around' ) ; } } // ## 4. Register our context menu listener. FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;