Where's the code that puts the uploaded file description into the editor?

Hi All. I am experimenting with the text that is displayed in the composer editor’s textarea when a file is uploaded. And I’m trying to figure out how the code works. When a user hits upload, and uploads a file (‘Cool-File.txt’), where is the code that puts the reference into the d-editor textarea?

For example, the text in the textarea that would read:
[Cool-File.txt|attachment](upload://8htnahUHYHnB11M.txt) (21.1 KB)

Where is the code that registers the upload event and inserts this text?


I’ve taken a look through the composer-editor.js methods like “getUploadMarkdown(upload)”, and the related methods like “attachmentMarkdown(upload)” in uploads.js. But changing these doesn’t seem to change anything.

Can you say more about what you want to do? I don’t know whether you might do it in a theme component or if you’d need a plugin.

The goal is just to understand where in the discourse code the code is that puts that text into the text area.

If it’s helpful to have a specific use case, how about: how would you change that text to something else?

If it makes a difference whether I’m doing a plug-in or theme component, I’m fine doing either.