النص البرمجي الخاص بي لا يعمل

I changed the template upload-selector.hbs
Before
image
After


The template works well, but my script refuses to work
image
I inserted this code in the “Header” tab
Please tell me what could be the problem?

إعجاب واحد (1)

You must write this stuff within Ember hooks because eg $document.ready is meaningless in an Ember app.

You may need to look at modifying the js of the modal’s controller depending on your needs.

إعجابَين (2)

Thanks for your reply. Why then in the manual Developer’s guide to Discourse Themes say what can be used?

إعجاب واحد (1)

It still works I guess for some use cases (the event will still fire) but if you want to do something intricate in a specific part of the interface I would not use such an event because it does not guarantee availability of some elements of the dom, unlike the ember hooks for components, for example.

إعجابَين (2)

Please tell me, is there any documentation so that I can implement something similar?

إعجاب واحد (1)

Usually with these things you will have to interpret the source code and use the Ember Guides to help you.

Additionally studying prior art in existing plugins or Theme Components can be really helpful.

3 إعجابات

Thanks. I will try to solve it

إعجابَين (2)