Skip to content

fix(ios): reset typing attributes before importing markdown - #646

Open
hsource wants to merge 1 commit into
software-mansion:mainfrom
wanderlog:fix/ios-import-markdown-reset-typing-attributes
Open

fix(ios): reset typing attributes before importing markdown#646
hsource wants to merge 1 commit into
software-mansion:mainfrom
wanderlog:fix/ios-import-markdown-reset-typing-attributes

Conversation

@hsource

@hsource hsource commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What/Why?

When setValue reloads markdown via importMarkdown, iOS assigns plain text using textView.text = .... UITextView stamps the current typingAttributes onto all of that text — including any list paragraph headIndent left over from where the cursor was before blur.

If the user blurs while focused in a nested list item, non-list paragraphs incorrectly pick up that list indent after setValue, even though the parsed markdown and block store are correct.

Reset base typing attributes before ENRMSetPlainText so import only applies block styling from the parsed markdown (via applyFormatting), not stale composer state from the previous cursor position.

Testing

  1. Open an editable EnrichedMarkdownTextInput with mixed content: a normal paragraph, a nested list, and another normal paragraph.
  2. Place the cursor in a nested list item.
  3. Blur the field while JS calls setValue with the current markdown (e.g. on blur to refresh link formatting).
  4. Before: non-list paragraphs render with the nested list indent.
  5. After: non-list paragraphs stay at normal indent; list items still render at the correct depth.

Tested on iOS

Before After
Before After

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

UITextView applies typingAttributes to all text assigned via .text. When
setValue runs while the cursor was in a list item, stale list paragraph
indent leaked onto non-list lines. Reset base attributes before
ENRMSetPlainText so importMarkdown only applies block styling from the
parsed markdown.

Co-authored-by: Cursor <cursoragent@cursor.com>
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