My plugin inserts a button in the composer toolbar. This toolbar opens a modal, and when the modal is closed I want to add text to the post. Everything works perfectly except the last step, because I’m struggling to give the modal access to the composer.
If I put the button under a menu in the toolbar, everything works fine:
The toolbarEvent should be available in your modal controller (discourse-n8n-wf), you don’t need to pass it. You can also look at how other modals do this, for example, see discourse-post-event-builder.js.es6 in the poll plugin.
I found the file you referenced in the discourse-calendar plugin (couldn’t find it in the poll one), but there it seems like the toolbarEvent is indeed being passed in the action (through setProperties())?
Ich bin mir nicht sicher, ob du hier noch feststeckst, aber ich bin auch der Sache nachgegangen, wie man von einem Modal aus auf das Toolbar-Ereignis zugreifen kann, und ich habe herausgefunden, dass man das Ereignis als Parameter wie folgt übergeben kann:
Ich möchte hinzufügen – Jahre später hatte ich dasselbe Problem (hatte keinen Zugriff auf toolbarEvent innerhalb eines Modals) und diese Lösung hat auch für mich funktioniert.