Rich Text Editor

WYSIWYG editor built on Tiptap for formatted content with headings, lists, links and more.

Rich text fields give users a full editor for formatted content. Built on Tiptap, it supports headings, bold/italic text, lists, links, blockquotes, code blocks and more.

Basic Usage

Add a rich text field using the addRichText() builder method:

app/Models/Survey.php

Available Settings

SettingTypeDescription
max_lengthintegerMaximum number of characters allowed (default from config)
allowed_extensionsarrayTiptap extensions to enable (default from config)

Global Configuration

Set default editor features and limits in your config/polyform.php file:

config/polyform.php

Validation

Rich text fields are validated by the RichTextFieldValidator. Content is stored as HTML and checked against character limits:

The character count includes HTML tags. If you need tighter control over content length, a textarea field may be a better fit.

Frontend Behavior

  • Floating toolbar appears when text is selected
  • Keyboard shortcuts (Cmd/Ctrl+B for bold, Cmd/Ctrl+I for italic, etc.)
  • Live character counter when max_length is set
  • Link dialog with URL validation
  • Markdown shortcuts (type # + space for heading, * + space for bullet list)
  • Paste support for formatted content from other applications

Storage Format

Rich text content is stored as sanitized HTML in the form submission. Only the tags and attributes from enabled extensions are kept, so the output stays clean and safe.

Accessibility

The rich text editor includes ARIA labels, keyboard navigation and screen reader support. Users can tab through toolbar buttons and use keyboard shortcuts to format text without a mouse.