Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Text): Support formatting and emojis in fromAttributed #615

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

absidue
Copy link
Collaborator

@absidue absidue commented Mar 1, 2024

This pull request refactors the handling of attributed text to add support for formatting (bold, italics, strikethrough) and emojis (custom ones and unicode ones). To avoid breaking changes, I took the approach of translating the new response as closely as possible to the existing classes and properties, so for anyone with existing code to handle TextRuns and EmojiRuns this should just work.

This currently only handles the styleRuns, commandRuns and attachmentRuns, however adding support for the decoratedRuns (only seen them used to add a grey "pill" around some links in video descriptions), shouldn't be too difficult with the way this is designed.

Examples:

To test the two comment use cases, you will need to use #614 too, so that it can handle the new comment nodes.

P.S. The way YouTube's attributed text works seems very similar to Apple's NSAttributedString/NSMutableAttributedString classes, so it seems likely that this may have originally been designed for the iOS client.

@LuanRT LuanRT merged commit e6f1f07 into LuanRT:main Mar 25, 2024
4 checks passed
@absidue absidue deleted the attributed-text-style-emojis branch March 25, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants