Closed Offerel closed 2 years ago
The props
property works much like the prop
option when doing something like output->button()
in the php. It is a string passed through to the core command function.
ret = this.command_handlers[command](props, obj, event);
it is what gets put into 'props' in the above. For example something like 'mail' in the switch-task
command. The second param which is always passed to the target function (this is part of the rc core code) is obj
which is a reference to the source object. There is also the environmental variable rcmail.env.context_menu_source_id
which contains the ID of the specific element that the context menu was triggered on.
I try to add a contextmenu for a list of li objects in my plugin. This works so far. The contextmenu comes up and i can click the entries there. After that the specified command is executed. But executing the commands make only sense, if i pass the id from the context to the command. For example the
"plugin.myplugin.show"
expects one parameter. This should be a integer, which is identical to theid
of the<li>
element, to where the contextmenu is opened. If i understand it right, i have to use"props"
, to pass such an argument to my command function. But i dont get it, what i have to enter here. This is my current code: