Want to pile on – years later, I had the same issue (didn’t have access to toolbarEvent inside a modal), and this solution also worked for me.
api.onToolbarCreate((toolbar) => {
toolbar.addButton({
...
sendAction: (event) =>
toolbar.context.send("triggerMyModal", event),
...
});
});
api.modifyClass("component:d-editor", {
modal: service(),
pluginId: "poll",
actions: {
triggerMyModal(toolbarEvent) {
this.modal.show(MyCustomModal, {
model: {
toolbarEvent,
},
});
},
},
});
Thanks for the help, Keegan.