From aa11348d007d1d0a9fbf9a28234e444fde2f21ac Mon Sep 17 00:00:00 2001 From: dakkar <dakkar@thenautilus.net> Date: Sat, 30 Mar 2024 10:54:25 +0000 Subject: [PATCH] `<bid>` all over the place --- .../global/MkMisskeyFlavoredMarkdown.ts | 49 +++++++++---------- packages/frontend/src/style.scss | 2 + 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index 22a02d4f60..df55d54269 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -335,67 +335,67 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven } case 'center': { - return [h('div', { + return [h('bdi',h('div', { style: 'text-align:center;', - }, genEl(token.children, scale))]; + }, genEl(token.children, scale)))]; } case 'url': { - return [h(MkUrl, { + return [h('bdi',h(MkUrl, { key: Math.random(), url: token.props.url, rel: 'nofollow noopener', - })]; + }))]; } case 'link': { - return [h(MkLink, { + return [h('bdi',h(MkLink, { key: Math.random(), url: token.props.url, rel: 'nofollow noopener', - }, genEl(token.children, scale, true))]; + }, genEl(token.children, scale, true)))]; } case 'mention': { - return [h(MkMention, { + return [h('bdi',h(MkMention, { key: Math.random(), host: (token.props.host == null && props.author && props.author.host != null ? props.author.host : token.props.host) ?? host, username: token.props.username, - })]; + }))]; } case 'hashtag': { - return [h(MkA, { + return [h('bdi',h(MkA, { key: Math.random(), to: isNote ? `/tags/${encodeURIComponent(token.props.hashtag)}` : `/user-tags/${encodeURIComponent(token.props.hashtag)}`, style: 'color:var(--hashtag);', - }, `#${token.props.hashtag}`)]; + }, `#${token.props.hashtag}`))]; } case 'blockCode': { - return [h(MkCode, { + return [h('bdi',h(MkCode, { key: Math.random(), code: token.props.code, lang: token.props.lang ?? undefined, - })]; + }))]; } case 'inlineCode': { - return [h(MkCodeInline, { + return [h('bdi',h(MkCodeInline, { key: Math.random(), code: token.props.code, - })]; + }))]; } case 'quote': { if (!props.nowrap) { - return [h('div', { + return [h('bdi',h('div', { style: QUOTE_STYLE, - }, genEl(token.children, scale, true))]; + }, genEl(token.children, scale, true)))]; } else { - return [h('span', { + return [h('bdi',h('span', { style: QUOTE_STYLE, - }, genEl(token.children, scale, true))]; + }, genEl(token.children, scale, true)))]; } } @@ -439,17 +439,17 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven } case 'mathInline': { - return [h(MkFormula, { + return [h('bdi',h(MkFormula, { formula: token.props.formula, block: false, - })]; + }))]; } case 'mathBlock': { - return [h(MkFormula, { + return [h('bdi',h(MkFormula, { formula: token.props.formula, block: true, - })]; + }))]; } case 'search': { @@ -472,9 +472,8 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven } }).flat(Infinity) as (VNode | string)[]; - return h('span', { - dir: 'auto', + return h('bdi', h('span', { // https://codeday.me/jp/qa/20190424/690106.html style: props.nowrap ? 'white-space: pre; word-wrap: normal; overflow: hidden; text-overflow: ellipsis;' : 'white-space: pre-wrap;', - }, genEl(rootAst, props.rootScale ?? 1)); + }, genEl(rootAst, props.rootScale ?? 1))); } diff --git a/packages/frontend/src/style.scss b/packages/frontend/src/style.scss index d876009961..8821f3cc7f 100644 --- a/packages/frontend/src/style.scss +++ b/packages/frontend/src/style.scss @@ -557,6 +557,8 @@ rt { // MFM ----------------------------- +div > bdi, p > bdi { display: block } + ._mfm_blur_ { filter: blur(6px); transition: filter 0.3s;