From 69ea6353983225f0dc85720db982faa5d8d72718 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 5 Jun 2020 23:19:00 +0100 Subject: [PATCH 1/2] Allow searching the emoji picker using other emoji Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- package.json | 4 ++-- src/emoji.ts | 4 ++-- yarn.lock | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index eae83d3878..93d59a4fa6 100644 --- a/package.json +++ b/package.json @@ -65,8 +65,8 @@ "create-react-class": "^15.6.0", "diff-dom": "^4.1.3", "diff-match-patch": "^1.0.4", - "emojibase-data": "^4.0.2", - "emojibase-regex": "^3.0.0", + "emojibase-data": "^5.0.1", + "emojibase-regex": "^4.0.1", "escape-html": "^1.0.3", "file-saver": "^1.3.3", "filesize": "3.5.6", diff --git a/src/emoji.ts b/src/emoji.ts index c0a755145a..753b808f4a 100644 --- a/src/emoji.ts +++ b/src/emoji.ts @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// @ts-ignore - import * as EMOJIBASE actually breaks this import EMOJIBASE from 'emojibase-data/en/compact.json'; export interface IEmoji { @@ -70,7 +69,8 @@ EMOJIBASE.forEach((emoji: IEmojiWithFilterString) => { DATA_BY_CATEGORY[categoryId].push(emoji); } // This is used as the string to match the query against when filtering emojis - emoji.filterString = `${emoji.annotation}\n${emoji.shortcodes.join('\n')}}\n${emoji.emoticon || ''}`.toLowerCase(); + emoji.filterString = `${emoji.annotation}\n${emoji.shortcodes.join('\n')}}\n${emoji.emoticon || ''}\n` + + `${emoji.unicode.split("\u200D").join("\n")}`.toLowerCase(); // Add mapping from unicode to Emoji object // The 'unicode' field that we use in emojibase has either diff --git a/yarn.lock b/yarn.lock index 393b89ba26..7e444a0e0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3155,15 +3155,15 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -emojibase-data@^4.0.2: - version "4.2.1" - resolved "https://registry.yarnpkg.com/emojibase-data/-/emojibase-data-4.2.1.tgz#3d1f0c69ddbb2ca7b7014f5e34654190802a40df" - integrity sha512-O0vxoPMgVkRq/uII/gdAjz9RwNv6ClJrd3J9QCCRC4btZRmeut/qohC/Fi+NNXUcjY08RWNTvxSnq/vij8hvrw== +emojibase-data@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/emojibase-data/-/emojibase-data-5.0.1.tgz#ce6fe36b4affd3578e0be8779211018a2fdae960" + integrity sha512-rYWlogJ2q5P78U8Xx1vhsXHcYKu1wFnr7+o6z9QHssZ1SsJLTCkJINZIPHRFWuDreAUK457TkqHpdOXElu0fzA== -emojibase-regex@^3.0.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/emojibase-regex/-/emojibase-regex-3.2.1.tgz#122935958c9a49c96bb29ac69ccbbac0b2e7022d" - integrity sha512-VAX2Rc2U/alu5q6P2cET2alzC63o1Uarm6Ea/b3ab+KOzxZT4JKmB0tCU1sTZvfNKa16KMLCK2k7hJBHJq4vWQ== +emojibase-regex@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/emojibase-regex/-/emojibase-regex-4.0.1.tgz#a2cd4bbb42825422da9ec72f15e970bc2c90b46a" + integrity sha512-S42UHkFfz15i4NNz+wi9iMKFo+B6Kalc6PJLpYX0BUANViXw4vSyYZMFdBGRLduSabWHuEcTLZl9xOa2YP3eJw== emojis-list@^2.0.0: version "2.1.0" From 0c32daa162e7f3b273f7b09efc1ce3b230398c21 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 5 Jun 2020 23:34:04 +0100 Subject: [PATCH 2/2] label ZWJ as such Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/emoji.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/emoji.ts b/src/emoji.ts index 753b808f4a..53625f3026 100644 --- a/src/emoji.ts +++ b/src/emoji.ts @@ -62,6 +62,8 @@ export const DATA_BY_CATEGORY = { "flags": [], }; +const ZERO_WIDTH_JOINER = "\u200D"; + // Store various mappings from unicode/emoticon/shortcode to the Emoji objects EMOJIBASE.forEach((emoji: IEmojiWithFilterString) => { const categoryId = EMOJIBASE_GROUP_ID_TO_CATEGORY[emoji.group]; @@ -70,7 +72,7 @@ EMOJIBASE.forEach((emoji: IEmojiWithFilterString) => { } // This is used as the string to match the query against when filtering emojis emoji.filterString = `${emoji.annotation}\n${emoji.shortcodes.join('\n')}}\n${emoji.emoticon || ''}\n` + - `${emoji.unicode.split("\u200D").join("\n")}`.toLowerCase(); + `${emoji.unicode.split(ZERO_WIDTH_JOINER).join("\n")}`.toLowerCase(); // Add mapping from unicode to Emoji object // The 'unicode' field that we use in emojibase has either