Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@yoopta/embed

Embed block plugin for Yoopta Editor. Renders embed blocks for URLs (e.g. YouTube, Vimeo, Twitter, Figma). Use headless or with theme UI from @yoopta/themes-shadcn.

Installation

yarn add @yoopta/embed

Usage

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

import { useMemo } from 'react';
import YooptaEditor, { createYooptaEditor } from '@yoopta/editor';
import Embed from '@yoopta/embed';

const plugins = [Embed];

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, Embed, /* ... */]);

Or: Embed.extend({ elements: EmbedUI }) with EmbedUI from @yoopta/themes-shadcn/embed.

Extend

Embed.extend({
  elements: {
    embed: { render: (props) => <YourEmbedBlock {...props} /> },
  },
  options: {
    display: { title: 'Embed', description: 'Embed a link' },
  },
});

See Embed plugin docs.