<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>