Compare commits

...

2 Commits

Author SHA1 Message Date
FloatingGhost 261a9da374 remove parsing of sparkle 2022-06-22 11:26:48 +01:00
FloatingGhost ca8689fc88 bugfix: don't error if emoji not found 2022-06-20 14:55:38 +01:00
+6 -5
View File
@@ -1,13 +1,12 @@
import { defineComponent, h } from 'vue' import { defineComponent, h } from 'vue'
import * as mfm from 'mfm-js' import * as mfm from 'mfm-js'
import MentionLink from '../mention_link/mention_link.vue' import MentionLink from '../mention_link/mention_link.vue'
import mention_link from '../mention_link/mention_link'
function concat (xss) { function concat (xss) {
return ([]).concat(...xss) return ([]).concat(...xss)
} }
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'sparkle', 'rotate'] export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'rotate']
export default defineComponent({ export default defineComponent({
props: { props: {
@@ -138,9 +137,6 @@ export default defineComponent({
style = 'animation: mfm-rainbow 1s linear infinite;' style = 'animation: mfm-rainbow 1s linear infinite;'
break break
} }
case 'sparkle': {
return h(MkSparkle, {}, genEl(token.children))
}
case 'rotate': { case 'rotate': {
const degrees = parseInt(token.props.args.deg) || '90' const degrees = parseInt(token.props.args.deg) || '90'
style = `transform: rotate(${degrees}deg); transform-origin: center center;` style = `transform: rotate(${degrees}deg); transform-origin: center center;`
@@ -234,6 +230,8 @@ export default defineComponent({
} }
case 'emojiCode': { case 'emojiCode': {
const emoj = this.status.emojis.find((emoji) => emoji.shortcode === token.props.name)
if (emoj) {
return [h('div', { return [h('div', {
class: 'still-image emoji img' class: 'still-image emoji img'
}, },
@@ -244,6 +242,9 @@ export default defineComponent({
src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url
})] })]
)] )]
} else {
return `:${token.props.name}:`
}
} }
case 'unicodeEmoji': { case 'unicodeEmoji': {