Ticket #958 (closed New Feature: fixed)
Context menu - supporting parameters
| Reported by: | Batalf | Owned by: | alfonsoml |
|---|---|---|---|
| Priority: | Normal | Milestone: | FCKeditor 2.6 |
| Component: | UI : Context Menu | Version: | |
| Keywords: | Review+ | Cc: |
Description (last modified by alfonsoml) (diff)
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
Change History
comment:1 Changed 6 years ago by alfonsoml
- Priority changed from High to Normal
- Keywords context menu,parameters, menu item removed
comment:3 Changed 5 years ago by alfonsoml
- 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.

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.