UBERF-5821 Fix incorrect emoji replacement (#4831)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-02-29 23:55:04 +07:00 committed by GitHub
parent 3e64ec0f07
commit 854325b5fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,7 @@ export const EmojiExtension = Extension.create({
addInputRules () { addInputRules () {
return Object.keys(emojiReplaceDict).map((pattern) => { return Object.keys(emojiReplaceDict).map((pattern) => {
return { return {
find: new RegExp(`(?:^|\\s)(${escapeRegExp(pattern)})`), find: new RegExp(`(?:^|\\s)(${escapeRegExp(pattern)})$`),
handler: ({ state, range, match, commands }) => { handler: ({ state, range, match, commands }) => {
const $from = state.doc.resolve(range.from) const $from = state.doc.resolve(range.from)
if (!isValidEmojiPosition($from)) { if (!isValidEmojiPosition($from)) {