mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 13:13:09 +02:00
Fix bug
refs: https://github.com/syuilo/misskey/pull/3117#discussion_r230624389
This commit is contained in:
parent
9719387bee
commit
b7f10fdc10
2 changed files with 15 additions and 6 deletions
|
@ -6,7 +6,15 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { lib } from 'emojilib';
|
import { lib } from 'emojilib';
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['emoji'],
|
props: {
|
||||||
|
emoji: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
customEmojis: {
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: null,
|
url: null,
|
||||||
|
@ -19,10 +27,10 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
exec() {
|
exec() {
|
||||||
const { emoji } = this;
|
const { emoji, customEmojis } = this;
|
||||||
this.name = emoji;
|
this.name = emoji;
|
||||||
(this as any).api('meta').then(meta =>
|
console.log(emoji, customEmojis)
|
||||||
this.url = meta && meta.emojis ? meta.emojis.find(e => e.name === emoji || e.aliases && e.aliases.includes(emoji)).url : null);
|
this.url = customEmojis && customEmojis.length ? customEmojis.find(e => e.name === emoji || e.aliases && e.aliases.includes(emoji)).url : null;
|
||||||
if (!this.url) {
|
if (!this.url) {
|
||||||
const { char } = lib[emoji] || { char: null };
|
const { char } = lib[emoji] || { char: null };
|
||||||
if (char) {
|
if (char) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Vue, { VNode } from 'vue';
|
import Vue, { VNode } from 'vue';
|
||||||
import * as emojilib from 'emojilib';
|
|
||||||
import { length } from 'stringz';
|
import { length } from 'stringz';
|
||||||
import parse from '../../../../../mfm/parse';
|
import parse from '../../../../../mfm/parse';
|
||||||
import getAcct from '../../../../../misc/acct/render';
|
import getAcct from '../../../../../misc/acct/render';
|
||||||
|
@ -189,8 +188,10 @@ export default Vue.component('misskey-flavored-markdown', {
|
||||||
|
|
||||||
case 'emoji': {
|
case 'emoji': {
|
||||||
const { emoji } = token;
|
const { emoji } = token;
|
||||||
|
const { customEmojis } = this;
|
||||||
return [createElement('mk-emoji', {
|
return [createElement('mk-emoji', {
|
||||||
attrs: { emoji }
|
attrs: { emoji },
|
||||||
|
props: { customEmojis }
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue