feat: implement EditorSaveContext and integrate save functionality in PlateEditor and FixedToolbarButtons

This commit is contained in:
Anish Sarkar 2026-02-17 01:30:38 +05:30
parent 0edfd116af
commit 1768887be8
8 changed files with 446 additions and 290 deletions

View file

@ -0,0 +1,19 @@
'use client';
import { BookOpenIcon, PenLineIcon } from 'lucide-react';
import { usePlateState } from 'platejs/react';
import { ToolbarButton } from './toolbar';
export function ModeToolbarButton() {
const [readOnly, setReadOnly] = usePlateState('readOnly');
return (
<ToolbarButton
tooltip={readOnly ? 'Click to edit' : 'Click to view'}
onClick={() => setReadOnly(!readOnly)}
>
{readOnly ? <BookOpenIcon /> : <PenLineIcon />}
</ToolbarButton>
);
}