From cf3d45e7c89fb1d2103c04315bee27a546bef34f Mon Sep 17 00:00:00 2001 From: paihu <13479783+paihu@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:09:22 +0900 Subject: [PATCH] fix(frontend): MFM ruby nyaize (#12362) --- CHANGELOG.md | 1 + .../src/components/global/MkMisskeyFlavoredMarkdown.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f7389c31..2d96a0232 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Client - Fix: ページ一覧ページの表示がモバイル環境において崩れているのを修正 +- Fix: MFMでルビの中のテキストがnyaizeされない問題を修正 ### Server - diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index d4c3ef60a..fe599dcea 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -242,11 +242,17 @@ export default function(props: MfmProps) { case 'ruby': { if (token.children.length === 1) { const child = token.children[0]; - const text = child.type === 'text' ? child.props.text : ''; + let text = child.type === 'text' ? child.props.text : ''; + if (!disableNyaize && shouldNyaize) { + text = doNyaize(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 : ''; + let text = rt.type === 'text' ? rt.props.text : ''; + if (!disableNyaize && shouldNyaize) { + text = doNyaize(text); + } return h('ruby', {}, [...genEl(token.children.slice(0, token.children.length - 1), scale), h('rt', text.trim())]); } }