Luthor
DocumentationDemoPlaygroundGitHub
Luthor

A headless, extensible rich text editor built on Lexical. Ship faster with production-ready defaults and TypeScript-first APIs.

Documentation

IntroductionInstallation@lyfie/headless@lyfie/luthor

Resources

DemoPlaygroundGitHubnpm Package

Support the Project

Buy me a coffeeStar on GitHub

Built with love by developers for developers.

DocsGitHubllms.txtllms-full.txt
  1. Home
  2. Docs
  3. Luthor Headless
  4. Features
  5. Media And Embeds

Luthor Documentation

Getting Started

  • Introduction
  • Installation
  • @lyfie/headless
  • @lyfie/luthor

@lyfie/headless

  • Features
  • Typography and Text
  • Structure and Lists
  • Media and Embeds
  • Code and Devtools
  • Interaction and Productivity
  • Customization and Theming

@lyfie/luthor

  • Presets
  • Extensive
  • Simple Text
  • Rich Text
  • Chat Window
  • Email Compose
  • Markdown
  • Notion Like
  • Headless Preset
  • Notes

Media and Embeds

This group covers rich media insertion.

Included extensions

  • imageExtension
  • iframeEmbedExtension
  • youTubeEmbedExtension

Example

tsx
import {
  createEditorSystem,
  RichText,
  richTextExtension,
  imageExtension,
  iframeEmbedExtension,
  youTubeEmbedExtension,
} from '@lyfie/luthor-headless';

const extensions = [
  richTextExtension,
  imageExtension,
  iframeEmbedExtension,
  youTubeEmbedExtension,
] as const;

const { Provider, useEditor } = createEditorSystem<typeof extensions>();

function Toolbar() {
  const { commands } = useEditor();
  return (
    <div>
      <button onClick={() => commands.insertImage?.({ src: '/demo/image.png', alt: 'Demo' })}>Image</button>
      <button onClick={() => commands.insertIframe?.({ src: 'https://example.com' })}>Iframe</button>
      <button onClick={() => commands.insertYouTube?.('dQw4w9WgXcQ')}>YouTube</button>
    </div>
  );
}

export function App() {
  return (
    <Provider extensions={extensions}>
      <Toolbar />
      <RichText placeholder="Add media..." />
    </Provider>
  );
}
Previous: Structure and Lists
Next: Code and Devtools