2026-02-17 12:47:39 +05:30
|
|
|
"use client";
|
2026-02-17 01:30:38 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
import { BookOpenIcon, PenLineIcon } from "lucide-react";
|
|
|
|
|
import { usePlateState } from "platejs/react";
|
2026-02-17 01:30:38 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
import { ToolbarButton } from "./toolbar";
|
2026-02-17 01:30:38 +05:30
|
|
|
|
|
|
|
|
export function ModeToolbarButton() {
|
2026-02-17 12:47:39 +05:30
|
|
|
const [readOnly, setReadOnly] = usePlateState("readOnly");
|
2026-02-17 01:30:38 +05:30
|
|
|
|
2026-02-17 12:47:39 +05:30
|
|
|
return (
|
|
|
|
|
<ToolbarButton
|
|
|
|
|
tooltip={readOnly ? "Click to edit" : "Click to view"}
|
|
|
|
|
onClick={() => setReadOnly(!readOnly)}
|
|
|
|
|
>
|
|
|
|
|
{readOnly ? <BookOpenIcon /> : <PenLineIcon />}
|
|
|
|
|
</ToolbarButton>
|
|
|
|
|
);
|
2026-02-17 01:30:38 +05:30
|
|
|
}
|