# 使用 api.onToolbarCreate 添加图片标签

**URL:** <https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800>\
**Category:** Development\
**Created:** [2025年十月27日 10:21 UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800 "2025-10-27T10:21:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)\
**Post date:** [2025年十月27日 10:21 UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800/1 "2025-10-27T10:21:23Z")

</div>

如果我在 `api.onToolbarCreate` 中有以下内容：

```js
perform: (e) => {
  e.applySurround(
    `[wrap="Carousel" autoplay=${settings.autoplay}]\n`,
    "\n[/wrap]",
    "image_carousel_placeholder"
  );
}

```

并且我的 `image_carousel_placeholder` 设置如下：

```yml
image_carousel_placeholder:
  type: upload
  default: "placeholder_image"

```

它会添加图像的 URL，而不是 `<img`\> 标签或 markdown `![]` 等效项。我该如何处理？我想避免将设置作为字符串输入实际的 `<img`\> 标签。这可能吗？

---

_[View the full topic](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800)._
