Skip to content

fix: use ClipboardEvent paste for Twitter text input#94

Open
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-twitter-paste
Open

fix: use ClipboardEvent paste for Twitter text input#94
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-twitter-paste

Conversation

@Astro-Han
Copy link
Contributor

Summary

  • Replace document.execCommand('insertText') with ClipboardEvent paste in post.ts and reply.ts
  • Fixes multi-paragraph text (\n\n) being lost in Twitter's Draft.js editor

Closes #93

Test plan

  • opencli twitter post --text "Line 1\n\nLine 2\n\nhttps://example.com" — all paragraphs appear in tweet
  • opencli twitter post --text "Single line" — still works as before
  • opencli twitter reply --url <tweet_url> --text "Para 1\n\nPara 2" — reply contains both paragraphs

Draft.js corrupts editor state when execCommand('insertText') encounters
paragraph breaks (\n\n), causing content loss. ClipboardEvent paste
triggers Draft.js's robust handlePastedText path instead.
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.

[Bug]: twitter post loses text content with paragraph breaks (\n\n)

1 participant