2026-02-17 12:47:39 +05:30
|
|
|
"use client";
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
import { BoldIcon, Code2Icon, ItalicIcon, StrikethroughIcon, UnderlineIcon } from "lucide-react";
|
|
|
|
|
import { KEYS } from "platejs";
|
|
|
|
|
import { useEditorReadOnly } from "platejs/react";
|
2026-02-20 22:44:56 -08:00
|
|
|
import * as React from "react";
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
import { LinkToolbarButton } from "./link-toolbar-button";
|
|
|
|
|
import { MarkToolbarButton } from "./mark-toolbar-button";
|
|
|
|
|
import { ToolbarGroup } from "./toolbar";
|
|
|
|
|
import { TurnIntoToolbarButton } from "./turn-into-toolbar-button";
|
2026-02-16 00:11:34 +05:30
|
|
|
|
|
|
|
|
export function FloatingToolbarButtons() {
|
2026-02-17 12:47:39 +05:30
|
|
|
const readOnly = useEditorReadOnly();
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
if (readOnly) return null;
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<ToolbarGroup>
|
|
|
|
|
<TurnIntoToolbarButton tooltip={false} />
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<MarkToolbarButton nodeType={KEYS.bold}>
|
|
|
|
|
<BoldIcon />
|
|
|
|
|
</MarkToolbarButton>
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<MarkToolbarButton nodeType={KEYS.italic}>
|
|
|
|
|
<ItalicIcon />
|
|
|
|
|
</MarkToolbarButton>
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<MarkToolbarButton nodeType={KEYS.underline}>
|
|
|
|
|
<UnderlineIcon />
|
|
|
|
|
</MarkToolbarButton>
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<MarkToolbarButton nodeType={KEYS.strikethrough}>
|
|
|
|
|
<StrikethroughIcon />
|
|
|
|
|
</MarkToolbarButton>
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<MarkToolbarButton nodeType={KEYS.code}>
|
|
|
|
|
<Code2Icon />
|
|
|
|
|
</MarkToolbarButton>
|
2026-02-16 00:11:34 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
<LinkToolbarButton tooltip={false} />
|
|
|
|
|
</ToolbarGroup>
|
|
|
|
|
</>
|
|
|
|
|
);
|
2026-02-16 00:11:34 +05:30
|
|
|
}
|