Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@yoopta/paragraph

Default paragraph (text) block plugin for Yoopta Editor. Use it headless or with theme UI from @yoopta/themes-shadcn.

Installation

yarn add @yoopta/paragraph

Usage

Pass the plugin to createYooptaEditor. Do not pass plugins to <YooptaEditor>.

import { useMemo } from 'react';
import YooptaEditor, { createYooptaEditor } from '@yoopta/editor';
import Paragraph from '@yoopta/paragraph';

const plugins = [Paragraph];

export default function Editor() {
  const editor = useMemo(() => createYooptaEditor({ plugins, marks: [] }), []);
  return <YooptaEditor editor={editor} onChange={() => {}} />;
}

Themed UI

import { applyTheme } from '@yoopta/themes-shadcn';
const plugins = applyTheme([Paragraph, /* ... */]);

Or extend a single plugin: Paragraph.extend({ elements: ParagraphUI }) with ParagraphUI from @yoopta/themes-shadcn/paragraph.

Default options

  • display: title 'Text', description 'Start writing plain text.'
  • shortcuts: ['p', 'text']

Extend

Paragraph.extend({
  elements: {
    paragraph: { render: (props) => <YourParagraph {...props} /> },
  },
  options: {
    shortcuts: ['para'],
    display: { title: 'Paragraph', description: 'Your description' },
    HTMLAttributes: { className: 'my-paragraph' },
  },
});

Classnames

  • .yoopta-paragraph — root element

See Paragraph plugin docs and Core plugins.