SurfSense/surfsense_web/components/ui/mark-toolbar-button.tsx

29 lines
615 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 { useMarkToolbarButton, useMarkToolbarButtonState } from "platejs/react";
2026-02-20 22:44:56 -08:00
import type * as React from "react";
2026-02-17 12:47:39 +05:30
import { ToolbarButton } from "./toolbar";
export function MarkToolbarButton({
2026-02-17 12:47:39 +05:30
clear,
nodeType,
...props
}: React.ComponentProps<typeof ToolbarButton> & {
2026-02-17 12:47:39 +05:30
nodeType: string;
clear?: string[] | string;
}) {
2026-02-17 12:47:39 +05:30
const state = useMarkToolbarButtonState({ clear, nodeType });
const { props: buttonProps } = useMarkToolbarButton(state);
2026-02-17 12:47:39 +05:30
return (
<ToolbarButton
{...props}
{...buttonProps}
onMouseDown={(e: React.MouseEvent) => {
e.preventDefault();
}}
/>
);
}