mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 17:26:23 +02:00
feat: implement EditorSaveContext and integrate save functionality in PlateEditor and FixedToolbarButtons
This commit is contained in:
parent
0edfd116af
commit
1768887be8
8 changed files with 446 additions and 290 deletions
19
surfsense_web/components/ui/mode-toolbar-button.tsx
Normal file
19
surfsense_web/components/ui/mode-toolbar-button.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue