Repository navigation
Render custom emoji inline and play animated images - #169
Merged
Merged
Conversation
hackers.pub serves custom emoji as <img alt=":name:" style="height:1em;..."> with no class or size attributes. parseInlineImage only accepted images inside links/mentions or with class inline-block, so emoji were dropped in preview mode, and extractImageBlocks pulled them out as full-width blocks in full mode, splitting the paragraph. Recognize emoji by an alt shortcode (or the web frontend's emoji class), keep them in the text flow, and size them relative to the surrounding text instead of a fixed 18dp circle crop. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add the coil-gif module. It registers itself through Coil's service loader: AnimatedImageDecoder on API 28+ (GIF, animated WebP, and animated HEIF on API 30+) and GifDecoder on API 26-27 (GIF only). This makes animated avatars, custom emoji, and inline images play instead of showing only the first frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166
Summary
Custom emoji rendering (
HtmlContent.kt)<img alt=":name:" style="height:1em;vertical-align:middle;display:inline-block;">(renderCustomEmojisinmodels/emoji.ts). There is no class, because sanitization stripsclass/stylefrom<img>before emoji are injected.<img>as inline when it sat inside a link/mention or hadclass="inline-block". As a result:altshortcode (or the web frontend'sclass="emoji") and kept in the text flow. They are sized relative to the surrounding text (1.2em) instead of a fixed 18dp circle crop. Mention avatars are unchanged.Animated images (Bug 2)
coil-gif, which registers itself through Coil's service loader:AnimatedImageDecoder(GIF, animated WebP, and animated HEIF on API 30+)GifDecoder(GIF only)Notes
transformAvatarreads only the first frame, andAvatarPickerre-encodes uploads as JPEG. That is out of scope here.NotificationsScreenusesNotification.React.emojiand ignorescustomEmoji. Left for a follow-up.Test plan
HtmlContentKtTest: new cases for server emoji markup,class="emoji", and plain body images still leaving the text flow./gradlew :app:lintDebug🤖 Generated with Claude Code