Full editor

This is components/editor/editor.tsx, exactly as the CLI installs it. Everything the editor can do is wired up here, so it is the best place to see how the pieces fit together.

0 words0 characters

Installation

Install the editor, then render DemoEditor, or rename it and use it as the starting point for your own.

npx shadcn@latest add @intentui/editor

What's included

Extensions

The dependencies list in defineExtension decides which behaviors the editor has.

ExtensionBehaviorPattern
RichTextExtensionRich text editing. Required.
HistoryExtensionUndo and redo.History
TabIndentationExtensionIndent with Tab.Alignment and indent
ListExtension, CheckListExtensionBulleted, numbered and check lists.Block format
HashtagExtension, SpecialTextExtensionHighlights hashtags and special words.Special text
LinkExtension, AutoLinkExtensionLinks and automatic link detection.Link
CodeExtensionCode blocks with syntax highlighting.Code block
LayoutExtensionColumns.Columns
EmojiExtensionEmoji nodes.Emoji
TableExtensionTables.Table
HorizontalRuleExtensionDividers.Divider
ImageExtension, DragDropPasteExtensionImages, including drag, drop and paste.Image
MentionExtensionMention nodes.Mention
AutocompleteExtensionInline suggestions.Autocomplete
TabFocusExtensionTab focus behavior.Tab focus
SpeechToTextExtensionDictation.Speech to text
ShortcutsExtensionKeyboard shortcuts.Shortcuts
FormatStateExtensionTracks the current format so controls reflect it.Text format
ClearEditorExtensionClears the document.Clear
ClipboardDOMImportExtensionCleaner pasting of HTML.
AutoFocusExtensionFocuses the editor on mount.

Markdown typing shortcuts are registered with registerMarkdownShortcuts in register, using the EDITOR_TRANSFORMERS list. See Markdown shortcuts.

Regions

RegionIn the fileDetails
Toolbar<Toolbar> with the toolbar pluginsToolbar
Content area<ContentEditable variant="draggable" />Content area
OverlaysDrag handle, floating toolbar, link editor, table actions, emoji picker, mentions, context menu, slash menuFloating toolbar, Slash menu
Activity bar<ActivityBar> with count, speech to text, read-only toggle and shortcutsActivity bar

Make it smaller

For an editor limited to what Markdown can express, see the Markdown editor, which ships as editor-md.tsx. For an editor built around the slash menu, see the Block editor, which ships as editor-block.tsx.

Delete what you do not need. Each pattern shows which extensions and plugins belong together, so you can remove a feature completely: its extension, its imports and its JSX.

Start with Text format, Slash menu and Table.