# 将上传文件的描述放入编辑器的代码在哪里？

**URL:** <https://meta.discourse.org/t/wheres-the-code-that-puts-the-uploaded-file-description-into-the-editor/215271>\
**Category:** Development\
**Created:** [2022年一月18日 21:51 UTC](https://meta.discourse.org/t/wheres-the-code-that-puts-the-uploaded-file-description-into-the-editor/215271 "2022-01-18T21:51:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)\
**Post date:** [2022年一月18日 21:51 UTC](https://meta.discourse.org/t/wheres-the-code-that-puts-the-uploaded-file-description-into-the-editor/215271/1 "2022-01-18T21:51:32Z")

</div>

大家好。我正在试验文件上传时显示在编辑器文本区域中的文本。我正在尝试弄清楚代码是如何工作的。当用户点击上传并上传文件（“Cool-File.txt”）时，将引用放入 d-editor 文本区域的代码在哪里？

例如，文本区域中的文本将显示为：  
`[Cool-File.txt|attachment](upload://8htnahUHYHnB11M.txt) (21.1 KB)`

注册上传事件并插入此文本的代码在哪里？

* * *

我查看了 composer-editor.js 方法，例如“getUploadMarkdown(upload)”以及 uploads.js 中相关的“attachmentMarkdown(upload)”方法。但更改这些似乎没有效果。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2022年一月18日 23:27 UTC](https://meta.discourse.org/t/wheres-the-code-that-puts-the-uploaded-file-description-into-the-editor/215271/2 "2022-01-18T23:27:38Z")

</div>

您能多说一些您想做什么吗？我不知道您是想在一个主题组件中完成，还是需要一个插件。

---

<div class="post-metadata">

**Author:** ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)\
**Post date:** [2022年一月19日 00:01 UTC](https://meta.discourse.org/t/wheres-the-code-that-puts-the-uploaded-file-description-into-the-editor/215271/3 "2022-01-19T00:01:45Z")

</div>

目标只是了解 discourse 代码中的哪个部分将文本放入文本区域。

如果有一个具体的用例会有帮助，那么：如何将该文本更改为其他内容？

如果插件或主题组件有区别，我可以做任何一个。
