Plugin: access to toolbarEvent from modal

Hey @sirdavidoff

Not sure if you’re still stuck on this but I’ve went down the rabbit hole of trying to figure out how to access the toolbar event from a modal as well, and I found you can pass the event as a parameter like this:

action: (event) =>

So I used it like this:

  const composerController = api.container.lookup('controller:composer');

  api.onToolbarCreate((toolbar) => {
    toolbar.addButton({
      id: 'math-editor',
      group: 'extras',
      icon: 'square-root-alt',
      sendAction: (event) => composerController.send('showMathEditor', event),
      title: themePrefix('insert_equation'),
    });
  });

and then you can use it in your action: {} method like so:

@action
showMathEditor(event) {
   showModal('matheditor-modal').set('toolbarEvent', event);
}