Skip to content

STTEDIT-3: Expose a new plainText prop that renders a <TextArea> by stripping any HTML tags down to their text content. - #120

Merged
Dmytro-Melnyshyn merged 3 commits into
mainfrom
STTEDIT-3
Aug 3, 2026
Merged

Dmytro-Melnyshyn merged 3 commits into
mainfrom
STTEDIT-3

Conversation

@Dmytro-Melnyshyn

@Dmytro-Melnyshyn Dmytro-Melnyshyn commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

  1. Body should be plain text only when the SMS/text message format is selected.
  2. Body field is a plain text box (no rich text formatting buttons)
  3. Mustache-style tokens (e.g. {{item.title}}) should be supported via a double-curly-braces button/picker
  4. Be able to disable image tokens
  5. Be able to disable the text editor entirely

Approach

1-3. Added a plainText prop to TemplateEditor. When set, it renders a <TextArea> instead of the rich-text editor, and strips any HTML on change via sanitizePlainText (DOMPurify, no allowed tags/attrs). The existing editAsHtml prop also renders a <TextArea>, but its sanitizer still lets tags through, so it doesn't fit here.
4. Now any token can have the disabled prop and be disabled (changes in TokensSection.js).
5. All style changes are directed to make it possible.

Issues

Initial - UICIRC-1350
Cloned for this repo - STTEDIT-3

Screenshots

image image image image

…ipping any HTML tags down to their text content.
@Dmytro-Melnyshyn
Dmytro-Melnyshyn requested a review from a team as a code owner July 29, 2026 21:50
@github-actions

github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Jest Unit Test Results

19 tests  +4   19 ✅ +4   7s ⏱️ -1s
 6 suites +2    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 1508226. ± Comparison against base commit 035795a.

♻️ This comment has been updated with latest results.

@Dmytro-Melnyshyn
Dmytro-Melnyshyn requested a review from a team July 30, 2026 06:06

@zburke zburke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

decodeHtmlEntities() is a sneaky-clever thing I never thought of doing before 😍

@Dmytro-Melnyshyn
Dmytro-Melnyshyn merged commit de47421 into main Aug 3, 2026
15 checks passed
@Dmytro-Melnyshyn
Dmytro-Melnyshyn deleted the STTEDIT-3 branch August 3, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants