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

29 lines
722 B
TypeScript
Raw Normal View History

2026-02-17 12:47:39 +05:30
"use client";
2026-02-17 12:47:39 +05:30
import type { PlateElementProps } from "platejs/react";
import { PlateElement, useFocused, useReadOnly, useSelected } 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 HrElement(props: PlateElementProps) {
2026-02-17 12:47:39 +05:30
const readOnly = useReadOnly();
const selected = useSelected();
const focused = useFocused();
2026-02-17 12:47:39 +05:30
return (
<PlateElement {...props}>
<div className="py-6" contentEditable={false}>
<hr
className={cn(
"h-0.5 rounded-sm border-none bg-muted bg-clip-content",
selected && focused && "ring-2 ring-ring ring-offset-2",
!readOnly && "cursor-pointer"
)}
/>
</div>
{props.children}
</PlateElement>
);
}