From 43cb2d478cab07ab60c95df31e75d506a681c8a8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 13:20:40 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20ruby=E5=86=85=E3=81=A7MFM?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E3=81=88=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/global/MkMisskeyFlavoredMarkdown.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index 1b6676920..163724a38 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -239,10 +239,15 @@ export default function(props: MfmProps) { break; } case 'ruby': { - const child = token.children[0]; - const text = child.type === 'text' ? child.props.text : ''; - return h('ruby', { - }, [text.split(' ')[0], h('rt', text.split(' ')[1])]); + if (token.children.length === 1) { + const child = token.children[0]; + const text = child.type === 'text' ? child.props.text : ''; + return h('ruby', {}, [text.split(' ')[0], h('rt', text.split(' ')[1])]); + } else { + const rt = token.children.at(-1)!; + const text = rt.type === 'text' ? rt.props.text : ''; + return h('ruby', {}, [...genEl(token.children.slice(0, token.children.length - 1), scale), h('rt', text.trim())]); + } } } if (style == null) {