'use client'; import { useEditorRef, useEditorSelector, withRef } from '@udecode/plate/react'; import { Redo2Icon, Undo2Icon } from 'lucide-react'; import { ToolbarButton } from './toolbar'; export const RedoToolbarButton = withRef((props, ref) => { const editor = useEditorRef(); const disabled = useEditorSelector( (editor) => editor.history.redos.length === 0, [], ); return ( editor.redo()} onMouseDown={(e) => e.preventDefault()} tooltip="Redo" {...props} > ); }); export const UndoToolbarButton = withRef((props, ref) => { const editor = useEditorRef(); const disabled = useEditorSelector( (editor) => editor.history.undos.length === 0, [], ); return ( editor.undo()} onMouseDown={(e) => e.preventDefault()} tooltip="Undo" {...props} > ); });