プラグイン:モーダルから toolbarEvent へのアクセス

@sirdavidoff さん、こんにちは。

まだこの問題で詰まっているか分かりませんが、私も同様にモーダルからツールバーイベントにアクセスする方法を調べていたところ、イベントをパラメータとして次のように渡せることを見つけました。

action: (event) =>

私はこのように使用しました。

  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'),
    });
  });

そして、次のように action: {} メソッドで使用できます。

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