From b7f10fdc10214a593d7c40062bd69b1e19017027 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: Mon, 5 Nov 2018 13:23:26 +0900 Subject: [PATCH] Fix bug refs: https://github.com/syuilo/misskey/pull/3117#discussion_r230624389 --- src/client/app/common/views/components/emoji.vue | 16 ++++++++++++---- .../components/misskey-flavored-markdown.ts | 5 +++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/client/app/common/views/components/emoji.vue b/src/client/app/common/views/components/emoji.vue index 2aa62de251..9c4d0c879d 100644 --- a/src/client/app/common/views/components/emoji.vue +++ b/src/client/app/common/views/components/emoji.vue @@ -6,7 +6,15 @@ import Vue from 'vue'; import { lib } from 'emojilib'; export default Vue.extend({ - props: ['emoji'], + props: { + emoji: { + type: String, + required: true + }, + customEmojis: { + required: false + } + }, data() { return { url: null, @@ -19,10 +27,10 @@ export default Vue.extend({ }, methods: { exec() { - const { emoji } = this; + const { emoji, customEmojis } = this; this.name = emoji; - (this as any).api('meta').then(meta => - this.url = meta && meta.emojis ? meta.emojis.find(e => e.name === emoji || e.aliases && e.aliases.includes(emoji)).url : null); + console.log(emoji, customEmojis) + this.url = customEmojis && customEmojis.length ? customEmojis.find(e => e.name === emoji || e.aliases && e.aliases.includes(emoji)).url : null; if (!this.url) { const { char } = lib[emoji] || { char: null }; if (char) { diff --git a/src/client/app/common/views/components/misskey-flavored-markdown.ts b/src/client/app/common/views/components/misskey-flavored-markdown.ts index c7368ecaf9..1948647e9a 100644 --- a/src/client/app/common/views/components/misskey-flavored-markdown.ts +++ b/src/client/app/common/views/components/misskey-flavored-markdown.ts @@ -1,5 +1,4 @@ import Vue, { VNode } from 'vue'; -import * as emojilib from 'emojilib'; import { length } from 'stringz'; import parse from '../../../../../mfm/parse'; import getAcct from '../../../../../misc/acct/render'; @@ -189,8 +188,10 @@ export default Vue.component('misskey-flavored-markdown', { case 'emoji': { const { emoji } = token; + const { customEmojis } = this; return [createElement('mk-emoji', { - attrs: { emoji } + attrs: { emoji }, + props: { customEmojis } })]; }