enhance(frontend): MFMでルビを振れるように

Resolve #9161
This commit is contained in:
syuilo
2023-11-17 13:09:56 +09:00
parent 5ab7e03804
commit b517d76084
5 changed files with 11 additions and 7 deletions

View File

@@ -45,12 +45,12 @@ import contains from '@/scripts/contains.js';
import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@/scripts/emoji-base.js';
import { acct } from '@/filters/user.js';
import * as os from '@/os.js';
import { MFM_TAGS } from '@/scripts/mfm-tags.js';
import { defaultStore } from '@/store.js';
import { emojilist, getEmojiName } from '@/scripts/emojilist.js';
import { i18n } from '@/i18n.js';
import { miLocalStorage } from '@/local-storage.js';
import { customEmojis } from '@/custom-emojis.js';
import { MFM_TAGS } from '@/const.js';
type EmojiDef = {
emoji: string;

View File

@@ -238,6 +238,12 @@ export default function(props: MfmProps) {
style = `background-color: #${color};`;
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 (style == null) {
return h('span', {}, ['$[', token.props.name, ' ', ...genEl(token.children, scale), ']']);