chore: add additional data attr for targeted customization of article css (#2421)

* chore: add additional data attr for targeted customization of article css

* update

* chore: auto-fix linting and formatting issues

---------

Co-authored-by: ericyzhu <ericyzhu@users.noreply.github.com>
This commit is contained in:
Eric Zhu 2025-01-03 17:15:20 +08:00 committed by GitHub
parent 9d6508b211
commit f97be400d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -28,9 +28,11 @@ export function EntryContentHTMLRenderer<AS extends keyof JSX.IntrinsicElements
} & HTMLProps<AS>) {
const entry = useEntry(entryId)
const feedSiteUrl = useFeedByIdSelector(feedId, (feed) =>
"siteUrl" in feed ? feed.siteUrl : undefined,
)
const { feedSiteUrl, feedUrl } =
useFeedByIdSelector(feedId, (feed) => ({
feedSiteUrl: "siteUrl" in feed ? feed.siteUrl : undefined,
feedUrl: "url" in feed ? feed.url : undefined,
})) || {}
const images: Record<string, MarkdownImage> = useMemo(() => {
return (
@ -63,7 +65,9 @@ export function EntryContentHTMLRenderer<AS extends keyof JSX.IntrinsicElements
<MarkdownRenderActionContext.Provider value={actions}>
<EntryInfoContext.Provider value={useMemo(() => ({ feedId, entryId }), [feedId, entryId])}>
{/* @ts-expect-error */}
<HTML {...props}>{children}</HTML>
<HTML data-feed-url={feedUrl} data-view={view} {...props}>
{children}
</HTML>
</EntryInfoContext.Provider>
</MarkdownRenderActionContext.Provider>
</MarkdownImageRecordContext.Provider>

View File

@ -276,12 +276,14 @@
"profile.email.verified": "已验证",
"profile.handle.description": "你的唯一标识。",
"profile.handle.label": "唯一标识",
"profile.link_social.authentication": "身份验证",
"profile.link_social.description": "目前只能连接具有相同邮件地址的社交帐户。",
"profile.link_social.link": "连接",
"profile.link_social.unlink.success": "已解除社交账户连接。",
"profile.name.description": "你的公开显示名称。",
"profile.name.label": "显示名称",
"profile.new_password.label": "新密码",
"profile.password.label": "密码",
"profile.reset_password_mail_sent": "重置密码邮件已发送。",
"profile.sidebar_title": "个人资料",
"profile.submit": "提交",
@ -377,5 +379,6 @@
"wallet.withdraw.error": "提现失败:{{error}}",
"wallet.withdraw.modalTitle": "提现 Power",
"wallet.withdraw.submitButton": "提交",
"wallet.withdraw.success": "提现成功!"
"wallet.withdraw.success": "提现成功!",
"wallet.withdraw.toRss3Label": "提现为 RSS3"
}