How to modify composer.js file into the plugin directory

AI-generated summary

Modifying Composer.js in a Discourse Plugin

Siddhu_Dhangar is developing a Discourse plugin, “topic curator,” and wants to modify the composer.js file without altering the main file. He successfully modified the composer.hbs template file but needs help with the JavaScript file.

Siddhu_Dhangar shared his GitHub link: https://github.com/siddhudhangar/discourse-topic-curator

david suggested using the Discourse JavaScript plugin API to achieve this.

Siddhu_Dhangar created a composer.js.es6 file in the initializers directory and used the api.modifyClass function to modify the save method in composer.js, successfully changing its functionality. He thanked david for his help.

Hi
I am writing one plugin named discourse topic curator in which i modified the composer.hbs template file but now i want to modify the composer.js file which is present in below path,
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/controllers/composer.js

i was able to modify composer.js file but i want to ask you that how i can modify this file in the plugin without touching main composer.js file which is present in controllers directory.

i shared my github link below with you
https://github.com/siddhudhangar/discourse-topic-curator

Could anybody help me out how to solve this problem ?

Please anyone help me out for solving this issue ?

You should use the javascript plugin API. If you explain what you’re trying to achieve, I’m sure we can work out the best API method to use.

I created one composer.js.es6 file in the initializers directory in composer.js.es6 file i added save method there and i was able to change some functionality of save method which is defined in composer.js file successfully using api.modifyClass function. Thank you very much @david
for your help.