返回 presentation-ai
hr-node.tsx
根目录 / src / components / plate / ui / hr-node.tsx
1 "use client";
2
3 import {
4 PlateElement,
5 useFocused,
6 useReadOnly,
7 useSelected,
8 type PlateElementProps,
9 } from "platejs/react";
10
11 import { cn } from "@/lib/utils";
12
13 export function HrElement(props: PlateElementProps) {
14 const readOnly = useReadOnly();
15 const selected = useSelected();
16 const focused = useFocused();
17
18 return (
19 <PlateElement {...props}>
20 <div className="py-6" contentEditable={false}>
21 <hr
22 className={cn(
23 "h-0.5 rounded-sm border-none bg-muted bg-clip-content",
24 selected && focused && "ring-2 ring-ring ring-offset-2",
25 !readOnly && "cursor-pointer",
26 )}
27 />
28 </div>
29 {props.children}
30 </PlateElement>
31 );
32 }
33
33 lines Plain Text