# Plugin: access to toolbarEvent from modal

**URL:** <https://meta.discourse.org/t/plugin-access-to-toolbarevent-from-modal/206413>\
**Category:** Development\
**Created:** [October 19, 2021, 7:02am UTC](https://meta.discourse.org/t/plugin-access-to-toolbarevent-from-modal/206413 "2021-10-19T07:02:11Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)\
**Post date:** [March 14, 2022, 5:30pm UTC](https://meta.discourse.org/t/plugin-access-to-toolbarevent-from-modal/206413/5 "2022-03-14T17:30:48Z")

</div>

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:

```js
  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:

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

```

---

_[View the full topic](https://meta.discourse.org/t/plugin-access-to-toolbarevent-from-modal/206413)._
