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 { 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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 }
 | 
			
		||||
					})];
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue