Acid Chicken (硫酸鶏) 2018-11-05 13:23:26 +09:00
parent 44f6d06ada
commit d2e9c7cd15
2 changed files with 15 additions and 6 deletions

View file

@ -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) {

View file

@ -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 }
})];
}