'use client';
import React from 'react';
import { withRef } from '@udecode/cn';
import { AIChatPlugin } from '@udecode/plate-ai/react';
import { BlockquotePlugin } from '@udecode/plate-block-quote/react';
import { CodeBlockPlugin } from '@udecode/plate-code-block/react';
import { type PlateEditor, ParagraphPlugin } from '@udecode/plate-common/react';
import { DatePlugin } from '@udecode/plate-date/react';
import { HEADING_KEYS } from '@udecode/plate-heading';
import { TocPlugin } from '@udecode/plate-heading/react';
import { INDENT_LIST_KEYS, ListStyleType } from '@udecode/plate-indent-list';
import { TablePlugin } from '@udecode/plate-table/react';
import { TogglePlugin } from '@udecode/plate-toggle/react';
import {
CalendarIcon,
ChevronRightIcon,
Code2,
Columns3Icon,
Heading1Icon,
Heading2Icon,
Heading3Icon,
ListIcon,
ListOrdered,
PilcrowIcon,
Quote,
SparklesIcon,
Square,
Table,
TableOfContentsIcon,
} from 'lucide-react';
import {
insertBlock,
insertInlineElement,
} from '~/components/editor/transforms';
import {
InlineCombobox,
InlineComboboxContent,
InlineComboboxEmpty,
InlineComboboxGroup,
InlineComboboxGroupLabel,
InlineComboboxInput,
InlineComboboxItem,
} from './inline-combobox';
import { PlateElement } from './plate-element';
type Group = {
group: string;
items: Item[];
};
interface Item {
icon: React.ReactNode;
onSelect: (editor: PlateEditor, value: string) => void;
value: string;
className?: string;
focusEditor?: boolean;
keywords?: string[];
label?: string;
}
const groups: Group[] = [
{
group: 'AI',
items: [
{
focusEditor: false,
icon:
, keywords: ['citation', 'blockquote', 'quote', '>'], label: 'Blockquote', value: BlockquotePlugin.key, }, ].map((item) => ({ ...item, onSelect: (editor, value) => { insertBlock(editor, value); }, })), }, { group: 'Advanced blocks', items: [ { icon: