Opened 15 years ago

Closed 15 years ago

#2687 closed New Feature (invalid)

Customize contextmenu using plugin

Reported by: mardiros Owned by:
Priority: Low Milestone:
Component: General Version:
Keywords: HasPatch Pending Cc:

Description

Plugins system is very cool,
but actually you cannot write one which is available with a right click.

And in fact, it's possible with a 50 line patch ( inspired by the FCKCommands style ). See the file joined

And now you can customize the FCKConfig.ContextMenu with whatever you want written in a plugin.

For example, a plugin with predifine value for a textfield can be create and accessible via toolbar and context menu.

FCKCommands.RegisterCommand( 'DynTextField', new FCKDialogCommand( 'DynTextField', FCKLang.DynTextFieldDlgTitle, FCKPlugins.Items['DynTextField'].Path + 'fck_DynTextField.cfm', 350, 300 ) ) ;

var oDynTextFieldItem = new FCKToolbarButton( 'DynTextField', FCKLang.DynTextFieldBtn ) ;
oDynTextFieldItem.IconPath = FCKPlugins.Items['DynTextField'].Path + 'DynTextField2.gif' ;
FCKToolbarItems.RegisterItem( 'DynTextField', oDynTextFieldItem ) ;

FCK.ContextMenu.RegisterCommand('DynTextField', {
            AddItems : function( menu, tag, tagName )
            {
                if ( tagName == 'INPUT' && ( tag.type == 'text' || tag.type == 'password' ) )
                {
                    menu.AddSeparator() ;
                    menu.AddItem( 'DynTextField', FCKLang.TextFieldProp, 51 ) ;
                }
            }}) ; 

Attachments (1)

plugin_contextmenu.patch (1.4 KB) - added by mardiros 15 years ago.

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by mardiros

Attachment: plugin_contextmenu.patch added

comment:1 Changed 15 years ago by Alfonso Martínez de Lizarrondo

Keywords: Pending added

I don't understand the problem. It's easy to add any command to the context menu without changing the core files.

Look for example at http://martinezdelizarrondo.com/imagemaps/

comment:2 Changed 15 years ago by mardiros

Priority: NormalLow

Oh!
I haven't seen it like that...
I will do like this too.

Remark ( not really important for myself )

  • You do not ordered item in context menu.
  • You do not choose in your config if you want your pluggin in the context or not.

Thanks for answering alfonsoml.

comment:3 Changed 15 years ago by Artur Formella

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy