Opened 10 years ago

Closed 9 years ago

#958 closed New Feature (fixed)

Context menu - supporting parameters

Reported by: Batalf Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: FCKeditor 2.6
Component: UI : Context Menu Version:
Keywords: Review+ Cc:

Description (last modified by Alfonso Martínez de Lizarrondo)

I have searched for this feature, but haven't found it.

What we need is the support for passing parameters from context menu item. We have implemented a list of paragraph styles in the context menu

Style
 |--- Style 1
      Style 2
      Style 3
      etc.

"Style 1", "Style 2" and "Style 3" will all call a function named "SetParagraphStyle". This function will assign the current <p> paragraph to a css class name. This class name is the param we need to send to this function.

I can't see that the AddItem method supports parameters.

Is this something that could be implemented? Or are there any workarounds?

Attachments (1)

958.patch (3.7 KB) - added by Alfonso Martínez de Lizarrondo 9 years ago.
Proposed SVN patch

Download all attachments as: .zip

Change History (7)

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

Keywords: context menu parameters menu item removed
Priority: HighNormal

You can create several commands (just one constructor and use several instances) and then set in each instance the parameter that you want when you are adding them to the context menu items.

comment:2 Changed 9 years ago by Alfonso Martínez de Lizarrondo

Description: modified (diff)
Owner: set to Alfonso Martínez de Lizarrondo

Changed 9 years ago by Alfonso Martínez de Lizarrondo

Attachment: 958.patch added

Proposed SVN patch

comment:3 Changed 9 years ago by Alfonso Martínez de Lizarrondo

Keywords: Review? added

When I coded the integration of the spellchecker for WriteArea I did in fact create a repeated number of commands, but it would have been easier and better fix it in the core, so here's the patch.

It does allow to add a parameter that will be sent to the Execute method of the related command, quite easy but powerful.

What's new entry:

The AddItem method now has an additional fifth parameter "tag" that will be send to the Execute method of the command for that menu item, allowing a single command to be used for different menu items.

comment:4 Changed 9 years ago by Frederico Caldeira Knabben

Keywords: Review+ added; Review? removed

Can we change the parameter name to "customData". It's more generic, and "tag" sounds much like an MS thing ;)

Please include the above changelog on commit.

comment:5 Changed 9 years ago by Frederico Caldeira Knabben

Milestone: FCKeditor 2.6

comment:6 Changed 9 years ago by Alfonso Martínez de Lizarrondo

Resolution: fixed
Status: newclosed

Fixed with [1602]

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy