feat(admin): 独立后台壳、站点分析与聊天监管,公开站拆出主题切换与访问埋点
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import type { AnchorHTMLAttributes } from "react";
|
||||
import { usePostLinkNewTab } from "@/components/PostLinkProvider";
|
||||
|
||||
type MdLinkProps = AnchorHTMLAttributes<HTMLAnchorElement>;
|
||||
|
||||
@@ -21,14 +22,15 @@ function isExternalHref(href?: string): boolean {
|
||||
return /^https?:\/\//i.test(href);
|
||||
}
|
||||
|
||||
/** Markdown 链接:外链新开页 */
|
||||
/** Markdown 链接:外链是否新开由站点设置 post_link_new_tab 控制 */
|
||||
export default function MdLink({ href, children, ...rest }: MdLinkProps) {
|
||||
const openInNewTab = usePostLinkNewTab();
|
||||
const external = isExternalHref(href);
|
||||
return (
|
||||
<a
|
||||
{...rest}
|
||||
href={href}
|
||||
{...(external
|
||||
{...(external && openInNewTab
|
||||
? { target: "_blank", rel: "noopener noreferrer" }
|
||||
: {})}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user