Skip to content

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

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

fix: skip text wrappers when mark value is falsy#104
SachinAryaMckinsey wants to merge 1 commit 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) {

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

1 participant