| @@ -17,6 +17,7 @@ import MkSparkle from '@/components/MkSparkle.vue'; | ||||
| import MkA from '@/components/global/MkA.vue'; | ||||
| import { host } from '@/config.js'; | ||||
| import { defaultStore } from '@/store.js'; | ||||
| import { nyaize } from '@/scripts/nyaize.js'; | ||||
|  | ||||
| const QUOTE_STYLE = ` | ||||
| display: block; | ||||
| @@ -55,10 +56,13 @@ export default function(props: { | ||||
| 	 * @param ast MFM AST | ||||
| 	 * @param scale How times large the text is | ||||
| 	 */ | ||||
| 	const genEl = (ast: mfm.MfmNode[], scale: number) => ast.map((token): VNode | string | (VNode | string)[] => { | ||||
| 	const genEl = (ast: mfm.MfmNode[], scale: number, disableNyaize = false) => ast.map((token): VNode | string | (VNode | string)[] => { | ||||
| 		switch (token.type) { | ||||
| 			case 'text': { | ||||
| 				const text = token.props.text.replace(/(\r\n|\n|\r)/g, '\n'); | ||||
| 				let text = token.props.text.replace(/(\r\n|\n|\r)/g, '\n'); | ||||
| 				if (!disableNyaize && props.author.isCat) { | ||||
| 					text = nyaize(text); | ||||
| 				} | ||||
|  | ||||
| 				if (!props.plain) { | ||||
| 					const res: (VNode | string)[] = []; | ||||
| @@ -260,7 +264,7 @@ export default function(props: { | ||||
| 					key: Math.random(), | ||||
| 					url: token.props.url, | ||||
| 					rel: 'nofollow noopener', | ||||
| 				}, genEl(token.children, scale))]; | ||||
| 				}, genEl(token.children, scale, true))]; | ||||
| 			} | ||||
|  | ||||
| 			case 'mention': { | ||||
| @@ -299,11 +303,11 @@ export default function(props: { | ||||
| 				if (!props.nowrap) { | ||||
| 					return [h('div', { | ||||
| 						style: QUOTE_STYLE, | ||||
| 					}, genEl(token.children, scale))]; | ||||
| 					}, genEl(token.children, scale, true))]; | ||||
| 				} else { | ||||
| 					return [h('span', { | ||||
| 						style: QUOTE_STYLE, | ||||
| 					}, genEl(token.children, scale))]; | ||||
| 					}, genEl(token.children, scale, true))]; | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| @@ -358,7 +362,7 @@ export default function(props: { | ||||
| 			} | ||||
|  | ||||
| 			case 'plain': { | ||||
| 				return [h('span', genEl(token.children, scale))]; | ||||
| 				return [h('span', genEl(token.children, scale, true))]; | ||||
| 			} | ||||
|  | ||||
| 			default: { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo