Skip to main content

Overview

The RichTextEditor is a powerful, extensible rich text editor built on Tiptap. It includes healthcare-specific extensions for citations, page breaks, and document formatting, making it ideal for creating medical reports, clinical notes, and other healthcare documentation.

Basic Usage

Advanced Features

Citation Support

The editor includes built-in support for citations that can link to source documents:

Custom Extensions

Add your own Tiptap extensions to enhance functionality:

API Reference

EditorProps

string
Additional CSS classes to apply to the editor container.
Ref<EditorHandle | undefined>
Ref to access the editor instance and methods.
JSONContent | string
Initial content for the editor. Can be HTML string or Tiptap JSON format.
Extensions
Additional Tiptap extensions to include in the editor.
function
Callback fired when editor content changes.
boolean
Show saving indicator in the toolbar.
function
Callback fired when text selection changes.
boolean
Make the editor read-only. Defaults to false.
function
Callback fired when a citation is clicked.

EditorHandle

The editorRef provides access to the underlying Tiptap editor instance:
Editor | null | undefined
The Tiptap editor instance with full API access.

Built-in Extensions

The RichTextEditor comes with a comprehensive set of pre-installed extensions:
  • Bold, Italic, Underline - Basic text styling
  • Strikethrough - Strike through text
  • Code - Inline code formatting
  • Superscript/Subscript - Scientific notation
  • Text Align - Left, center, right, justify

Workflow Integration

Saving to Task State

Integrate with the workflow system to persist editor content:

Document Templates

Create reusable document templates:

Keyboard Shortcuts

The editor supports standard keyboard shortcuts for efficient editing:
  • Ctrl/Cmd + B - Bold
  • Ctrl/Cmd + I - Italic
  • Ctrl/Cmd + U - Underline
  • Ctrl/Cmd + Shift + S - Strikethrough
  • Ctrl/Cmd + E - Inline code
  • Ctrl/Cmd + Alt + 1-6 - Headings H1-H6
  • Ctrl/Cmd + Shift + 7 - Ordered list
  • Ctrl/Cmd + Shift + 8 - Bullet list
  • Ctrl/Cmd + Shift + 9 - Blockquote
  • Ctrl/Cmd + Alt + C - Code block

Styling and Theming

The editor inherits styles from your application’s theme and can be customized:
The editor uses CSS classes that are compatible with Tailwind CSS and can be styled using your existing design system.

Citation System

The citation system allows linking text segments to source documents:

Best Practices

Performance: For large documents, consider implementing lazy loading or pagination to maintain smooth editing performance.
Auto-save: Implement debounced auto-saving to prevent data loss while avoiding excessive API calls.
Content Validation: Always validate and sanitize content before saving, especially when accepting user input.
Accessibility: The editor includes built-in accessibility features. Ensure any custom extensions also follow accessibility guidelines.