| 1 | "use client"; |
| 2 | |
| 3 | import { Trash2 } from "lucide-react"; |
| 4 | |
| 5 | import { ToolbarButton } from "@/components/plate/ui/toolbar"; |
| 6 | import { useToolbarContext } from "./ToolbarContext"; |
| 7 | |
| 8 | export function DeleteButton() { |
| 9 | const { editor } = useToolbarContext(); |
| 10 | |
| 11 | return ( |
| 12 | <ToolbarButton |
| 13 | onClick={() => editor.tf.blockSelection.removeNodes()} |
| 14 | tooltip="Delete Element" |
| 15 | size="sm" |
| 16 | className="text-destructive hover:bg-destructive/10 hover:text-destructive" |
| 17 | > |
| 18 | <Trash2 className="size-4" /> |
| 19 | </ToolbarButton> |
| 20 | ); |
| 21 | } |
| 22 |