From 9f09afc82498dee76ca0b1a71d5fe5502d14bd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Fri, 7 Dec 2018 17:21:34 +0900 Subject: [PATCH] Fix bug caused by Chrome 71 (#3535) * Update emoji.vue * Update autocomplete.vue * Update emoji.vue * Update autocomplete.vue * Update emoji.vue --- src/client/app/common/views/components/autocomplete.vue | 3 ++- src/client/app/common/views/components/emoji.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/app/common/views/components/autocomplete.vue b/src/client/app/common/views/components/autocomplete.vue index 2d9d70034..1d860ff54 100644 --- a/src/client/app/common/views/components/autocomplete.vue +++ b/src/client/app/common/views/components/autocomplete.vue @@ -44,8 +44,9 @@ const lib = Object.entries(emojilib.lib).filter((x: any) => { }); const char2file = (char: string) => { - let codes = [...char].map(x => x.codePointAt(0).toString(16)); + let codes = Array.from(char).map(x => x.codePointAt(0).toString(16)); if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f'); + codes = codes.filter(x => x && x.length); return codes.join('-'); }; diff --git a/src/client/app/common/views/components/emoji.vue b/src/client/app/common/views/components/emoji.vue index 4ea2ea941..29b09947e 100644 --- a/src/client/app/common/views/components/emoji.vue +++ b/src/client/app/common/views/components/emoji.vue @@ -66,8 +66,9 @@ export default Vue.extend({ } if (this.char) { - let codes = [...this.char].map(x => x.codePointAt(0).toString(16)); + let codes = Array.from(this.char).map(x => x.codePointAt(0).toString(16)); if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f'); + codes = codes.filter(x => x && x.length); this.url = `https://twemoji.maxcdn.com/2/svg/${codes.join('-')}.svg`; }