+ "content": "import {\n BoldPlugin,\n CodePlugin,\n ItalicPlugin,\n StrikethroughPlugin,\n UnderlinePlugin,\n} from '@udecode/plate-basic-marks/react';\nimport { BlockquotePlugin } from '@udecode/plate-block-quote/react';\nimport { CodeBlockPlugin } from '@udecode/plate-code-block/react';\nimport { Plate, usePlateEditor } from '@udecode/plate-common/react';\nimport { HeadingPlugin } from '@udecode/plate-heading/react';\nimport Prism from 'prismjs';\n\nimport { createPlateUI } from '@/lib/plate/create-plate-ui';\nimport { Editor } from '@/components/plate-ui/editor';\n\nexport default function BasicPluginsComponentsDemo() {\n const editor = usePlateEditor({\n override: { components: createPlateUI() },\n plugins: [\n BlockquotePlugin,\n CodeBlockPlugin.configure({ options: { prism: Prism } }),\n HeadingPlugin,\n BoldPlugin,\n ItalicPlugin,\n UnderlinePlugin,\n StrikethroughPlugin,\n CodePlugin,\n ],\n value: basicEditorValue,\n });\n\n return (\n <Plate editor={editor}>\n <Editor placeholder=\"Type...\" autoFocus={false} spellCheck={false} />\n </Plate>\n );\n}\n\nexport const basicEditorValue = [\n {\n id: '1',\n children: [\n {\n text: '🌳 Blocks',\n },\n ],\n type: 'h1',\n },\n {\n id: '2',\n children: [\n {\n text: 'Easily create headings of various levels, from H1 to H6, to structure your content and make it more organized.',\n },\n ],\n type: 'p',\n },\n {\n id: '3',\n children: [\n {\n text: 'Create blockquotes to emphasize important information or highlight quotes from external sources.',\n },\n ],\n type: 'blockquote',\n },\n {\n id: '4',\n children: [\n {\n children: [\n {\n text: '// Use code blocks to showcase code snippets',\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: 'function greet() {',\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: \" console.info('Hello World!');\",\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: '}',\n },\n ],\n type: 'code_line',\n },\n ],\n lang: 'javascript',\n type: 'code_block',\n },\n {\n id: '1',\n children: [\n {\n text: '🌱 Marks',\n },\n ],\n type: 'h1',\n },\n {\n id: '2',\n children: [\n {\n text: 'Add style and emphasis to your text using the mark plugins, which offers a variety of formatting options.',\n },\n ],\n type: 'p',\n },\n {\n id: '3',\n children: [\n {\n text: 'Make text ',\n },\n {\n bold: true,\n text: 'bold',\n },\n {\n text: ', ',\n },\n {\n italic: true,\n text: 'italic',\n },\n {\n text: ', ',\n },\n {\n text: 'underlined',\n underline: true,\n },\n {\n text: ', or apply a ',\n },\n {\n bold: true,\n italic: true,\n text: 'combination',\n underline: true,\n },\n {\n text: ' of these styles for a visually striking effect.',\n },\n ],\n type: 'p',\n },\n {\n id: '4',\n children: [\n {\n text: 'Add ',\n },\n {\n strikethrough: true,\n text: 'strikethrough',\n },\n {\n text: ' to indicate deleted or outdated content.',\n },\n ],\n type: 'p',\n },\n {\n id: '5',\n children: [\n {\n text: 'Write code snippets with inline ',\n },\n {\n code: true,\n text: 'code',\n },\n {\n text: ' formatting for easy readability.',\n },\n ],\n type: 'p',\n },\n {\n id: '6',\n children: [\n {\n text: 'Press ',\n },\n {\n kbd: true,\n text: '⌘+B',\n },\n {\n text: ' to apply bold mark or ',\n },\n {\n kbd: true,\n text: '⌘+I',\n },\n {\n text: ' for italic mark.',\n },\n ],\n type: 'p',\n },\n];\n",
0 commit comments