-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Emojiundo #3405
Emojiundo #3405
Conversation
Changelog EntryAdded
Samples
DescriptionAdded emoticon to Emoji in the send box. DesignWe designed this feature not to relies on Style optionsEnable Emojis (default){
styleOptions: {
emojiSet: true
}
} Disable Emojis{
styleOptions: {
emojiSet: false
}
} Or Custom Emoji set{
styleOptions: {
emojiSet: {
'100': '💯'
}
}
} HooksIt is not trivial for end-developer to re-build their own Emoji-enabled send box. This is because they must re-build their own undo stack. Otherwise, the "chemical reaction" between Thus, we are not exposing any hooks. However, they can access the const [{ emojiSet }] = useStyleOptions(); We are not exposing the The FYI, they are needed because we need to know which character was changed. We are only replacing emoticons when the user finish the emoticon with its last character. I.e. user press D after the We are not replacing emoticons for the whole string as that would make the UI very difficult to use (every key press will convert to Emoji). Thus, the FYI, although if we used But these operations are not distinguishable from each other when using Clipboard or typingWe do not want to convert emoticons to Emojis when the user paste the text. Instead, the conversion should only be done when the user type on the send box. Technically, we cannot distinguishable whether the user type a letter, or the user pasted a letter. We are using our best effort to guess if the user is pasting the text (≧ 2 characters) or typing the letter (= 1 character). We also failed this case but IMO, this is marginal:
This is not perfect but this is as far as we could go. RedoWe did not implement CTRL + Y (redo) yet. EscapingWe did not implement escaping. Specific Changes
Review Checklist
|
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.
Looks good, although rather complex.
event => { | ||
const { ctrlKey, key, metaKey } = event; | ||
|
||
if ((ctrlKey || metaKey) && (key === 'Z' || key === 'z')) { |
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.
Is ctrl+Z
typical for undo?
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.
CTRL + Z is de facto on Windows. And I guess COMMAND + Z is de facto on Mac.
You spotted the corner I cut here. 😁
Please let me know if I should only allow COMMAND + Z on Mac but not CTRL + Z.
Thanks @a-b-r-o-w-n. Agree, rather complex. OS will push undo checkpoint on:
But since HTML doesn't have cross-browser Better, I should "subclass" |
TBD