返回 presentation-ai
equation-toolbar-button.tsx
根目录 / src / components / plate / ui / equation-toolbar-button.tsx
1 "use client";
2
3 import type * as React from "react";
4
5 import { insertInlineEquation } from "@platejs/math";
6 import { RadicalIcon } from "lucide-react";
7 import { useEditorRef } from "platejs/react";
8
9 import { ToolbarButton } from "./toolbar";
10
11 export function InlineEquationToolbarButton(
12 props: React.ComponentProps<typeof ToolbarButton>,
13 ) {
14 const editor = useEditorRef();
15
16 return (
17 <ToolbarButton
18 {...props}
19 onClick={() => {
20 insertInlineEquation(editor);
21 }}
22 tooltip="Mark as equation"
23 >
24 <RadicalIcon />
25 </ToolbarButton>
26 );
27 }
28
28 lines Plain Text