I would like to open the composer from my plugin. But I cannot use the composing a new pre-filled topic via URL method, because I don’t want to change the route.
I’ve tried the method explained here, but it doesn’t seem to work. I’ve tried to send the composer:opened event to other objects (router, application route, application controller, composer controller) but without any success.
I’ve been more successful with the method described here, using this kind of code:
Uncaught SyntaxError: Unexpected token < markdown-it-bundle.js:1
Error: Could not find module pretty-text/engines/discourse-markdown/helpers discourse/lib/text:40
at missingModule (discourse-loader:134)
at require (discourse-loader:149)
at setup (pretty-text/engines/discourse-markdown-it:242)
at buildOptions (pretty-text/pretty-text:100)
at getOpts (discourse/lib/text:25)
at cook (discourse/lib/text:30)
at eval (discourse/lib/text:38)
at tryCatch (ember:50180)
at invokeCallback (ember:50195)
at publish (ember:50163)
It does, I added that warning yesterday because I got bitten by it.
It means that you (or another plugin) have previously called container.lookup("controller:composer") which cached the instance of the composer controller on the container and any changes made to the composer class (through modifyClass or reopen) won’t apply.
If you did the lookup, then you need to move the modifyClassbefore it.
If you didn’t, you need to put your initializer before the one calling it.
Thanks, got it, I’ve fixed the warning.
However, I’ve just realized the markdown error is not linked to me wanting to open the composer from my plugin. I’m ashamed I didn’t check earlier, but the problem occurs also when creating a new topic using Discourse UI.
I’m about to report this issue in another topic, so that people landing here are not too confused.
EDIT: here is the new topic.