To extend the existing textarea context menu implementation in a reusable way, create a template that pre-uses vexi.widget.textareaand place a read trap in the property contextActions. We can use cascadeto invoke reading from this property, i.e. Call an existing implementation that returns an array. We just add to this array:
<vexi xmlns="vexi.widget">
<textarea>
thisbox.contextActions ++= function() {
var actions = cascade;
actions.push(
new .menuitem({
text: "Foo",
action: function(v) { cascade = v; vexi.log.info("foo"); },
enabled: enabled
}));
return actions;
}
</textarea>
</vexi>
Traps, <textarea> ( ..). , src/vexi/widget/textarea.t, . , org.vexi.lib.widget.textarea preapplies org.vexi.lib.text.contextmenu // ..