Skip to content

Conversation

@Soxasora
Copy link
Member

@Soxasora Soxasora commented Dec 27, 2025

Description

Fixes #2717
Removes ​/\u200b that gets injected by some browsers (Chromium).

We don't generate the ZWS in our editor, but can be copied and pasted from somewhere else. Since this character can spawn in other circumstances (HTML import, node replacements, some Android IMEs), the most effective place to remove this character is inside the markdown strings we give to the MDAST pipelines (export/import).

Screenshots

tbd

Additional Context

Removing the ZWS inside the editor, while editing, involves selection heuristics that we're better off not touching. Lexical uses it on any device that's not Apple.

This character can't spawn unwillingly on iOS devices, it's a Chrom(ium) thing afaict

Checklist

Are your changes backward compatible? Please answer below:

For example, a change is not backward compatible if you removed a GraphQL field or dropped a database column.
Yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
7, touches only textnode visitors

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
Not a frontend change, but I've tested this on Android which is the most impacted platform.

Did you introduce any new environment variables? If so, call them out explicitly here:
n/a

Did you use AI for this? If so, how much did it assist you?
No


Note

Ensures markdown passed through Lexical and MDAST is free of zero‑width spaces that some browsers inject.

  • Add removeZeroWidthSpace and apply it in $getMarkdown, markdownToLexical (pre-import), and lexicalToMarkdown (post-export)
  • Update FormikBridgePlugin to use $getMarkdown() for syncing, instead of raw getTextContent()
  • Keep empty-state handling via $isMarkdownEmpty() unchanged

Written by Cursor Bugbot for commit ac64e59. This will update automatically on new commits. Configure here.

}
}
})
return removeZeroWidthSpace(markdown)
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure this'll cover every edge case since parsing can fail with ZWS. So I'll add a comment to address this when we'll reach the Rich Text stage

@huumn huumn merged commit 2c26b3b into stackernews:master Dec 27, 2025
7 checks passed
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.

Rendering artifacts at the end of some links

2 participants