-
-
Notifications
You must be signed in to change notification settings - Fork 813
Auto-replace emoticons with emojis in new composer #3342
Conversation
this to support finding emoticons and replacing them with an emoji
aa2fe1e to
0273795
Compare
turt2live
left a comment
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.
The tests really help with understanding this code, so thank you for including them :)
I have documentation concerns, but nothing too controversial I hope.
| import {renderModel} from '../../../editor/render'; | ||
| import {Room} from 'matrix-js-sdk'; | ||
| import TypingStore from "../../../stores/TypingStore"; | ||
| import EMOJIBASE from 'emojibase-data/en/compact.json'; |
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.
we should consider importing the user's language in the future, if that's even a thing that makes sense
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.
Not sure, are emoticons internationalized? That's the only thing we use it for here, mapping emoticons to emojis. Textual description is not used here.
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.
ah, if we're just using their shapes and not descriptions it is probably fine. There's probably some locale-specific emoji out there, but I don't think we've ever received a request for them.
as the amount of characters might not have changed, parts may still have been merged, removed or added which requires a new position.
also add more inline comments to explain what is going on
|
Found another bug where at the start of the editor typing ";) " would replace with ";😉 ", fixed now. |
turt2live
left a comment
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.
still magic to me
Implements element-hq/element-web#10629
To support auto-replacing emoticons, which can span multiple parts, the model gains support for a transform step where a range can be opened on the model, and replace with other parts. This is used to find and replace emoticons.