This repository has no description
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import { BlocksFeature, CodeBlock, HeadingFeature, HorizontalRuleFeature, lexicalEditor,} from '@payloadcms/richtext-lexical'import { LinkPreviewBlock, CalloutBlock, MediaBlock } from '@/blocks'
const codeLanguages: Record<string, string> = { plaintext: 'Plain Text', bash: 'Bash', shell: 'Shell', text: 'Text', env: '.env', diff: 'Diff', javascript: 'JavaScript', js: 'JavaScript', jsx: 'JSX', typescript: 'TypeScript', ts: 'TypeScript', tsx: 'TSX', json: 'JSON', yaml: 'YAML', toml: 'TOML', html: 'HTML', css: 'CSS', scss: 'SCSS', vue: 'Vue', svelte: 'Svelte', python: 'Python', ruby: 'Ruby', php: 'PHP', go: 'Go', rust: 'Rust', java: 'Java', kotlin: 'Kotlin', swift: 'Swift', c: 'C', cpp: 'C++', csharp: 'C#', sql: 'SQL', graphql: 'GraphQL', markdown: 'Markdown', mdx: 'MDX', dockerfile: 'Dockerfile',}
export const bodyEditor = lexicalEditor({ features: ({ defaultFeatures }) => [ ...defaultFeatures, HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4', 'h5', 'h6'] }), HorizontalRuleFeature(), BlocksFeature({ blocks: [ LinkPreviewBlock, CalloutBlock, MediaBlock, CodeBlock({ defaultLanguage: 'typescript', languages: codeLanguages }), ], }), ],})