-
-
Notifications
You must be signed in to change notification settings - Fork 578
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
Add option to use native emoji #731
Conversation
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.
Hey, thank you for this PR! 🙂 I like the idea of using native (or specifically, Apple's) emoji.
There are some things that need to be fixed first, though. Other than these, I'll also look into electron/electron#11874 issue.
fadf2f5
to
b1df780
Compare
To sort by "completeness"
@CvX resolved all outstanding issues |
Build for testing: https://we.tl/t-9V4ZMO0boX |
Could you elaborate on this? Shouldn't the emoji be displayed like the surrounding text? |
I think emoji should always be displayed as they are – full opacity, no tinting. That's how they are displayed with other emoji sets anyway. |
The error that causes the "Could not display composer" is
It seems like messenger doesn't like us messing with their DOM nodes? |
Yeah… 😕 …I have an idea… that involves removing the You know how currently the emoji replacement introduced in #720 uses redirects to change which emoji image is getting displayed? Well, it's possible to redirect to a dataURL! 😃 So we can render emoji (taken from the original URL and processes with |
I'm kind of out of ideas on this one. I think what we're seeing here is React holding a references to the old The emojis in the message editor are possible to replace without this error because they use |
Nice, that should work. But it'll have to be done through IPC I think since the interceptor is defined in the main process. |
Yup, the strategy would be pretty much like in #731 (comment). 🙂 |
It's a bit annoying that there is no real IPC layer used yet, like JSON RPC or comlink. |
Seems to work |
172d656
to
430dea2
Compare
Should be all fixed! 🎉 |
Messenger’s default should be first.
An update on "broken emojis" issue: As per electron/electron#16530 Electron 5.0.0-beta.1 contains a newer Chromium version that fixes most (though not all) emoji rendering problems: It seems that there's a change in emoji's vertical offset when rendering, so on 5.0.0-beta.1 they're cut off a bit at the top. It's something to look out for when we upgrade after 5.0 stabilizes. Anyway, I'm marking this one as "fixed". |
The earliest I can get to this is next week, anyone is welcome to push/PR to the branch. |
Merged in master with change to TypeScript |
Thank you! 🎉🚀 |
…felixfbecker/native-emoji # Conflicts: # package.json # source/emoji.ts
Btw I just discovered OffscreenCanvas which is also available in WebWorkers. I wonder if it's available in the Electron main process? |
When I suggested the use of canvas I originally thought we could use the offscreen variant, but when I tried it… nope! 😄 Wasn't available in the context of the main process. |
Hm, I don't think Electron's offscreen rendering is a good fit here. Keeping a spare (hidden) frameless window just for rendering emoji seems excessive. 😃 |
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.
🚀
All done! |
Fixes #672 Co-authored-by: Jarek Radosz <[email protected]>
Nice work, everyone! 🎉 |
|
Closes #672
Adds a new option "native" to the emoji menu.
Uses a MutationObserver to swap emoji
img
elements with the actual emoji text, and injects CSS to show the native emoji in the editor.Also added a bunch more docblocks with type info.
I did not enable it by default because unfortunately some emoji are rendered as multiple characters, which is an Electron bug I wasn't able to work around: electron/electron#11874
Despite this flaw (which I hope will be fixed in the future) I would still use this option and think it is good to have.