# Topic Template Placeholder Text 主题组件

**URL:** <https://meta.discourse.org/t/topic-template-placeholder-text-theme-component/149053>\
**Category:** Theme component\
**Created:** [2020年四月23日 19:20 UTC](https://meta.discourse.org/t/topic-template-placeholder-text-theme-component/149053 "2020-04-23T19:20:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Rhidian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhidian/32/176630_2.png) [@Rhidian](https://meta.discourse.org/u/Rhidian)\
**Post date:** [2020年四月23日 19:20 UTC](https://meta.discourse.org/t/topic-template-placeholder-text-theme-component/149053/1 "2020-04-23T19:20:00Z")

</div>

# 主题模板占位符文本主题组件

此主题组件使您能够将主题模板显示为占位符（水印），而不是可编辑的模板文本。

这允许您为每个主题提供自定义说明作为占位符。

例如：

这是正常的占位符（水印）文本。

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/2/e2ecf1aa5d97f75d95d73747c4725d1949779abe.png)

注意：您现在可以通过更改自定义文本来全局更改此设置。

> 前往 管理 \> 自定义 \> 文本
> 
> 然后搜索您在屏幕上看到的文本。  
> 搜索“BBCode”应该能帮您找到所需内容：
> 
> 然后将 js.composer.reply\_placeholder 的值更改为您想要显示的占位符文本

您也可以在每个类别中设置主题模板。

在“编辑类别”对话框中选择“主题模板”。您可以为类别添加自定义模板。

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/2/a23b6926d81eb86965ded3b3369b96c0f3d65d4b.png)

这效果很好，但用户必须删除模板文本后才能开始输入帖子。

此主题组件使您能够将主题模板文本显示为占位符（水印）文本，而不是可编辑文本。您只需点击文本框即可开始输入。

它可以设置为将所有主题模板显示为占位符，或者您可以通过在主题模板中添加 [placeholder] 指示符，按个案进行设置。

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/7/77db4bd50f8610da8eab774b830c2bfd936fbb99.png)

### 安装主题组件

🛠 Git 仓库：[https://github.com/naidihr/discourse-topic-template-placeholders](https://github.com/naidihr/discourse-topic-template-placeholders)

🤔 [如何安装主题或主题组件？](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)

### 致谢

感谢 @merefield 重构 JQuery 元素以使用 Ember 框架和 Discourse 核心。

请注意，更新后的版本仅测试在 Discourse 2.4.1 及以上版本中可用。如果您使用的是更早的 Discourse 版本，请尝试原始版本，该版本已在 2.3.10 版本中测试。  
原始版本仓库：[https://github.com/naidihr/discourse-topic-template-placeholders\_original](https://github.com/naidihr/discourse-topic-template-placeholders_original)

---

_[View the full topic](https://meta.discourse.org/t/topic-template-placeholder-text-theme-component/149053)._
