'use client'; import * as React from 'react'; import { indentListItems, unindentListItems } from '@platejs/list-classic'; import { useListToolbarButton, useListToolbarButtonState, } from '@platejs/list-classic/react'; import { IndentIcon, List, ListOrdered, ListTodo, OutdentIcon, } from 'lucide-react'; import { KEYS } from 'platejs'; import { useEditorRef } from 'platejs/react'; import { ToolbarButton } from './toolbar'; const nodeTypeMap: Record = { [KEYS.olClassic]: { icon: , label: 'Numbered List' }, [KEYS.taskList]: { icon: , label: 'Task List' }, [KEYS.ulClassic]: { icon: , label: 'Bulleted List' }, }; export function ListToolbarButton({ nodeType = KEYS.ulClassic, ...props }: React.ComponentProps & { nodeType?: string; }) { const state = useListToolbarButtonState({ nodeType }); const { props: buttonProps } = useListToolbarButton(state); const { icon, label } = nodeTypeMap[nodeType] ?? nodeTypeMap[KEYS.ulClassic]; return ( {icon} ); } export function IndentToolbarButton({ reverse = false, ...props }: React.ComponentProps & { reverse?: boolean; }) { const editor = useEditorRef(); return ( { if (reverse) { unindentListItems(editor); } else { indentListItems(editor); } }} tooltip={reverse ? 'Outdent' : 'Indent'} > {reverse ? : } ); }