# Js.composer.reply\_placeholder is ook van toepassing op nieuwe onderwerpen en antwoorden

**URL:** https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963
**Category:** Bug
**Created:** [15 oktober 2024 om 12:23 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963 "2024-10-15T12:23:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [15 oktober 2024 om 12:23 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963/1 "2024-10-15T12:23:12Z")

</div>

#### Issue Description

The js.compser.reply\_placeholder text appears to be coupled to the text in the composer when a topic is _created_, despite being reply specific.

#### How to reproduce?

This can be seen by comparing a modified version of placeholder text to the composer.

#### Some fixes that come to mind

One fix might be to change the name of the placeholder, however we would _love_ to have the option to modify the placeholders of both replies and creates separately.

#### Why would create and reply placeholders be useful?

As shown below, we’ve started using the following placeholder text for new topics. However, this guidance makes no sense in the context of a reply.

 ![The image displays a computer screen with a word processor open, showing a blank document with a title bar at the top. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/8/1/3/813f2aae67be4e3eab79d84f225fe7076e7fc1b5.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/a/6/4/a64d26a73f23e3083a8aac3ae1f43f525c8bbc68.png)

If the fix for this resulted in a placeholder for both replies and creating, we would be able to provide improved JIT guidance for all users(which would be amazing for support communities like ours).

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [15 oktober 2024 om 12:39 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963/2 "2024-10-15T12:39:03Z")

</div>

Maybe the code in this topic helps you

> [@New Topic + Reply: Distinquish Ephemeral Text](https://meta.discourse.org/t/new-topic-reply-distinquish-ephemeral-text/205575/2):
>
> Correct, the placeholder for both new topics and replies share the same translation key as you mentioned js.composer.reply\_placeholder As far as I know, there haven’t been any requests for separate keys so far. Still, you can customize this on your site for now. If you add the following to your theme in the common \> header tab, it should give you the desired result. \<script type="text/discourse-plugin" version="0.8"\> // options you can change const placeHolderForReplies = "CHANGE\_THIS\_TEXT\_B…

---

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [15 oktober 2024 om 12:46 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963/3 "2024-10-15T12:46:53Z")

</div>

❤ That’s a great find. Gave it quick try and seems to very nicely separate the reply and create placeholders. Would love to see this change made in core, but very happy to use the changes given by Joe. Thanks for linking this @Moin

---

<div class="post-metadata">

### Author: ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)
#### Post date: [15 oktober 2024 om 14:45 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963/4 "2024-10-15T14:45:20Z")

</div>

Just as a followup, the code snippet posted by Joe didn’t work as expected with our new topic button: when a user creates a new topic while they were reading a topic, they would get the reply text.

Below is an alternative appraoch which:

- Presents a placeholder for new topics whether they are started in the Categories page or from within a topic
- Presents a different placeholder for replies

```javascript
<script type="text/discourse-plugin" version="0.8">
// Custom placeholders
const placeHolderForReplies = `When helping someone else:

1. Describe what you think the problem is
2. Tell them what you think they should do
3. Show them how to do it (code snippets, images, etc)
4. Include links and references `;

const placeHolderForNewTopics = `Type here.

1. Tell us what you're trying to do.
2. Tell us what you already tried.
3. Post error logs as code snippets.`;

// Import required modules
const discourseComputed = require("discourse-common/utils/decorators").default;
const currentLocale = I18n.currentLocale();
I18n.translations[currentLocale].js.composer.custom_reply_placeholder = placeHolderForReplies;
I18n.translations[currentLocale].js.composer.custom_topic_placeholder = placeHolderForNewTopics;

api.modifyClass("component:composer-editor", {
  @discourseComputed("composer.replyingToTopic", "composer.creatingTopic")
  replyPlaceholder(replyingToTopic, creatingTopic) {
    // Determine if the composer is for replying or creating a new topic
    if (creatingTopic) {
      return "composer.custom_topic_placeholder"; // New topic placeholder
    } else if (replyingToTopic) {
      return "composer.custom_reply_placeholder"; // Reply placeholder
    }
    return this._super(...arguments); // Fallback to default behavior
  }
});
</script>

```

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [15 oktober 2024 om 14:54 UTC](https://meta.discourse.org/t/js-composer-reply-placeholder-applies-to-new-topics-as-well-as-replies/330963/5 "2024-10-15T14:54:01Z")

</div>

There is also

> [@Topic Template Placeholder Text theme component](https://meta.discourse.org/t/topic-template-placeholder-text-theme-component/149053):
>
> Topic Template Placeholder Text theme component This theme component enables you to display Topic Templates as placeholders (watermarks) instead of as editable template text. This allows you to provide custom instructions as a placeholder for each topic. For example: This is the normal placeholder (watermark) text. NB You can already change this site-wide by changing the custom text Go to Admin \>\> Customise \>\> Text Then search for the text that you see there on the screen. A se…
