Skip to content

fix: skip text wrappers when mark value is falsy - #104

Open
SachinAryaMckinsey wants to merge 93 commits into
contentstack:masterfrom
SachinAryaMckinsey:fix/skip-falsy-text-marks
Open

fix: skip text wrappers when mark value is falsy#104
SachinAryaMckinsey wants to merge 93 commits into
contentstack:masterfrom
SachinAryaMckinsey:fix/skip-falsy-text-marks

Conversation

@SachinAryaMckinsey

Copy link
Copy Markdown

Summary

Fixes a bug in toRedactor where text marks (e.g. bold, italic, underline) were applied even when their value was explicitly false. Previously, the code only checked whether the mark key existed on the node, not whether its value was truthy — so a child like { text: "foo", bold: false } would still be wrapped in <strong>.

Changes

  • src/toRedactor.tsx: Added a truthiness check so a text wrapper is only applied when the mark's value is truthy:

    - if (localTextWrappers.hasOwnProperty(key)) {
    + if (localTextWrappers.hasOwnProperty(key) && value) {

shreya-kamble and others added 30 commits January 10, 2025 11:28
fix: encode social-embeds and embeds src urls
fix: escape html entities in attr values
feat: handle invalid attr key-values
No.of br tags  should match /n on shift+enter
naithanishant and others added 27 commits August 20, 2025 12:21
[RT-611][bug] Moved the constants to separate file and used them to create local vars to make changes
[RT-611][bug] Moved the constants to separate file and used them to create local vars to make changes
- Pin lodash 4.18.1; npm overrides for omit-deep-lodash, form-data,
  @tootallnate/once transitive issues
- Upgrade esbuild beyond GHSA advisory range; bump uuid to ^11.x
- Move Jest to 29 with jest-environment-jsdom; ts-jest and jsdom updates
- Add jest.setup.js for TextEncoder/TextDecoder under jsdom
- Set skipLibCheck in tsconfig for stable declaration builds

Co-authored-by: Cursor <cursoragent@cursor.com>
chore(deps): security fixes and toolchain updates [EXP-406]
Only apply a text wrapper (e.g. bold/italic/underline) when its value is
truthy, so marks explicitly set to false no longer wrap the text. Adds
tests covering falsy and mixed mark values.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SachinAryaMckinsey
SachinAryaMckinsey requested a review from a team as a code owner June 17, 2026 06:11
@rohan-naik
rohan-naik requested a review from a team as a code owner August 13, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants