SurfSense/surfsense_web/components/ui/link-node.tsx

32 lines
806 B
TypeScript
Raw Normal View History

2026-02-17 12:47:39 +05:30
"use client";
2026-02-20 22:44:56 -08:00
import { getLinkAttributes } from "@platejs/link";
2026-02-17 12:47:39 +05:30
import type { TLinkElement } from "platejs";
import type { PlateElementProps } from "platejs/react";
import { PlateElement } from "platejs/react";
2026-02-20 22:44:56 -08:00
import * as React from "react";
2026-02-17 12:47:39 +05:30
import { cn } from "@/lib/utils";
export function LinkElement(props: PlateElementProps<TLinkElement>) {
2026-02-17 12:47:39 +05:30
return (
<PlateElement
{...props}
as="a"
className={cn(
"font-medium text-blue-600 underline decoration-blue-600 underline-offset-4 hover:text-blue-800 dark:text-blue-400 dark:decoration-blue-400 dark:hover:text-blue-300"
)}
attributes={{
...props.attributes,
...getLinkAttributes(props.editor, props.element),
onMouseOver: (e) => {
e.stopPropagation();
},
}}
>
{props.children}
</PlateElement>
);
}