import { CodeHighlightNode, CodeNode } from "@lexical/code"; import { AutoLinkNode, LinkNode } from "@lexical/link"; import { ListItemNode, ListNode } from "@lexical/list"; import { TRANSFORMERS } from "@lexical/markdown"; import { LexicalComposer } from "@lexical/react/LexicalComposer"; import { ContentEditable } from "@lexical/react/LexicalContentEditable"; import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary"; import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"; import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin"; import { ListPlugin } from "@lexical/react/LexicalListPlugin"; import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin"; import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"; import { HeadingNode, QuoteNode } from "@lexical/rich-text"; import { TableCellNode, TableNode, TableRowNode } from "@lexical/table"; import type { Dispatch, SetStateAction } from "react"; import { classNames } from "@calcom/lib"; import ExampleTheme from "./ExampleTheme"; import AutoLinkPlugin from "./plugins/AutoLinkPlugin"; import ToolbarPlugin from "./plugins/ToolbarPlugin"; import "./stylesEditor.css"; /* Detault toolbar items: - blockType - bold - italic - link */ export type TextEditorProps = { getText: () => string; setText: (text: string) => void; excludedToolbarItems?: string[]; variables?: string[]; height?: string; placeholder?: string; disableLists?: boolean; updateTemplate?: boolean; firstRender?: boolean; setFirstRender?: Dispatch>; editable?: boolean; }; const editorConfig = { theme: ExampleTheme, onError(error: Error) { throw error; }, namespace: "", nodes: [ HeadingNode, ListNode, ListItemNode, QuoteNode, CodeNode, CodeHighlightNode, TableNode, TableCellNode, TableRowNode, AutoLinkNode, LinkNode, ], }; export const Editor = (props: TextEditorProps) => { const editable = props.editable ?? true; return (
} placeholder={ props?.placeholder ? (
{props.placeholder}
) : null } ErrorBoundary={LexicalErrorBoundary} /> { if (index !== 3 && index !== 4) return value; }) : TRANSFORMERS } />
); };