The Portable Text Editor is a headless, schema-driven rich text editor framework created by the team at Sanity. It is specifically built to handle Portable Text, which is an open, JSON-based specification for structured content instead of relying on legacy formats like raw HTML or Markdown.
Unlike traditional “What You See Is What You Get” (WYSIWYG) text tools, this package operates on a headless model: it takes care of all the data validation, real-time collaboration logic, and cursor selections, while leaving the entire visual styling and user interface completely to the developer. Core Concepts of Portable Text
The framework does away with standard markup tags. Instead, content is stored in an array of JSON objects called “blocks”: Blocks: Usually represent paragraphs, headers, or lists.
Spans: Text fragments inside a block that share the exact same style formatting.
Decorators & Annotations: Inline markers applied to text spans, such as bold/italic formatting or data-rich hyperlink entities.
Custom Block Types: Specialized objects mixed directly into the text array, allowing developers to embed complex components like code snippets, image galleries, or YouTube videos natively. Key Features Rich text comments on your Next.js blog with Portable Text
Leave a Reply