You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform tested: iOS (Expo dev build, simulator). Android not yet tested.
Description
Toggling a single inline format (e.g. bold) while there is no selection (just a caret) starts an empty styled span. Pressing Enter immediately, without typing, splits that empty span across the paragraph boundary. Because inline emphasis can't cross a block boundary, the serializer closes and reopens it, producing an empty, meaningless marker pair in the output. It only happens on the first Enter (the empty span is consumed after that).
Steps to reproduce
Render an EnrichedMarkdownTextInput, focus it (empty document, caret on first line).
Call ref.toggleBold() (or tap a bold toolbar button) — no text selected.
Press Return without typing anything.
Read onChangeMarkdown / getMarkdown().
const ref = useRef<EnrichedMarkdownTextInputInstance>(null);
// focus, then:
ref.current?.toggleBold();
// user presses Enter
// onChangeMarkdown fires with:
Expected:"\n" (an empty bold toggle with no content should produce nothing, or just the newline).
Actual:"**\n**" — a stray open/close bold pair straddling the newline. Confirmed via getMarkdown(), so it persists into saved content. Same for the other formats: italic → "*\n*", strikethrough → "~~\n~~", underline → "_\n_", and stacked (bold+italic) → "***\n***".
Environment
react-native-enriched-markdown:0.7.0-nightly-20260529-af2d2f8630.81.5· Expo SDK54Description
Toggling a single inline format (e.g. bold) while there is no selection (just a caret) starts an empty styled span. Pressing Enter immediately, without typing, splits that empty span across the paragraph boundary. Because inline emphasis can't cross a block boundary, the serializer closes and reopens it, producing an empty, meaningless marker pair in the output. It only happens on the first Enter (the empty span is consumed after that).
Steps to reproduce
EnrichedMarkdownTextInput, focus it (empty document, caret on first line).ref.toggleBold()(or tap a bold toolbar button) — no text selected.onChangeMarkdown/getMarkdown().Expected:
"\n"(an empty bold toggle with no content should produce nothing, or just the newline).Actual:
"**\n**"— a stray open/close bold pair straddling the newline. Confirmed viagetMarkdown(), so it persists into saved content. Same for the other formats: italic →"*\n*", strikethrough →"~~\n~~", underline →"_\n_", and stacked (bold+italic) →"***\n***".Screen.Recording.2026-06-01.at.4.08.41.PM.mov