Skip to content

DEV: Apply transformer for composer editor reply placeholder #32943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

markvanlan
Copy link
Contributor

@markvanlan markvanlan commented May 27, 2025

This adds an applyValueTransformer for the Composer textarea's placeholder text. Shocked there isn't one already!

Comment on lines 134 to 151
let placeholder;
if (requiredCategoryMissing) {
return "composer.reply_placeholder_choose_category";
placeholder = "composer.reply_placeholder_choose_category";
} else {
const key = authorizesOneOrMoreImageExtensions(
this.currentUser.staff,
this.siteSettings
)
? "reply_placeholder"
: "reply_placeholder_no_images";
return `composer.${key}`;
placeholder = `composer.${key}`;
}

return applyValueTransformer(
"composer-editor-reply-placeholder",
placeholder,
{ model: this.composer }
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, a bit of 🏌️

Maybe something like this seems better?

  let placeholder = "composer.reply_placeholder_choose_category";

  if (!requiredCategoryMissing) {
    const key = authorizesOneOrMoreImageExtensions(
      this.currentUser.staff,
      this.siteSettings
    )
      ? "reply_placeholder"
      : "reply_placeholder_no_images";
    placeholder = `composer.${key}`;
  }

  return applyValueTransformer(
    "composer-editor-reply-placeholder",
    placeholder,
    { model: this.composer }
  );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call -- I initially didn't like this b/c it makes the "base case" something that is if'd but whatever, this is better. will commit.

@davidtaylorhq davidtaylorhq changed the title DEV: Apply modifier for composer editor reply placeholder DEV: Apply transformer for composer editor reply placeholder May 27, 2025
@markvanlan markvanlan merged commit 90ee5cf into main May 27, 2025
17 checks passed
@markvanlan markvanlan deleted the modifier-4-reply-placeholder branch May 27, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants