-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Rendering emojis in MarkdownTextBlock #1625
Conversation
{ | ||
var emoji = new Run | ||
{ | ||
FontFamily = EmojiFontFamily ?? new FontFamily("Segoe UI Emoji"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the end of this a private const like 'default emoji font'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should update sample for markdown text box to include an example.
|
||
// Codes taken from https://gist.github.com/rxaviers/7360908 | ||
// Ignoring not implented symbols in Segoe UI Emoji font (e.g. :bowtie:) | ||
private static readonly Dictionary<string, int> _emojiCodesDictionary = new Dictionary<string, int> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-hawker Is it ok to have this dictionary here or should I make this class partial and move dictionary to another file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually wondering how we should manage it. Splitting it out at least into a separate partial class is a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need an _emojiCodesDictionary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hermitdave it's what translates :smile:
into the actual character needed by the font for display 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh crap.. GitHub didn't show me that file at all.
I'm at an event today, so dismissing to not block future integration. Someone else should sign-off when changes are made. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing. Other than few formatting warnings, looks great. If you can get these updated today, we can get this in 2.1 :)
@@ -109,7 +114,7 @@ static Common() | |||
SuperscriptTextInline.AddTripChars(_triggerList); | |||
CodeInline.AddTripChars(_triggerList); | |||
ImageInline.AddTripChars(_triggerList); | |||
|
|||
EmojiInline.AddTripChars(_triggerList); | |||
// Create an array of characters to search against using IndexOfAny. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line comment must be preceded by blank line
|
||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse | ||
{ | ||
internal partial class EmojiInline : MarkdownInline, IInlineLeaf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial elements must be documented
Image | ||
Image, | ||
|
||
///<summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation line must begin with space
|
||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Parse | ||
{ | ||
internal partial class EmojiInline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial elements must be documented
@nmetulev Fixed formatting issues |
Issue: #1515
PR Type
What kind of change does this PR introduce?
What is the current behavior?
No emoji support in MarkdownTextBlock
PR Checklist
Please check if your PR fulfills the following requirements:
What is the new behavior?
Emojis are rendered in MarkdownTextBlock
Does this PR introduce a breaking change?
Other information