Skip to content

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

Merged
LuanRT merged 1 commit intoLuanRT:mainfrom
absidue:attributed-text-style-emojis
Mar 25, 2024
Merged

feat(Text): Support formatting and emojis in fromAttributed#615
LuanRT merged 1 commit intoLuanRT:mainfrom
absidue:attributed-text-style-emojis

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
@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