TipTap editor

Circle has chosen TipTap as the foundation for its text editor, used across posts, comments, and messages. You will usually find it under tiptap_body property inside posts or as the content of a message.

Blocks

TipTap's foundation is based on the concept of blocks. A block a self-contained unit of content that has it's own structure, formatting, and functionality.

Examples

  • A paragraph of text

  • An image

  • A video embed

  • A quote or testimonial

  • A list (ordered or unordered)

  • A custom interactive element (like a poll)

Available blocks

Circle has a few TipTap blocks ready to be used out-of-the-box.

{
  type:
    | 'doc'
    | 'paragraph'
    | 'heading'
    | 'blockquote'
    | 'orderedList'
    | 'bulletList'
    | 'image'
    | 'text'
    | 'hardBreak'
    | 'mention'
    | 'listItem'
    | 'embed'
    | 'codeBlock'
    | 'horizontalRule'
    | 'file'
    | 'entity'
    | 'poll'
}
  • Paragraph

  • Heading level 2

  • Heading level 3

  • Bulleted list

  • Numbered list

  • Blockquote

  • Embeds (Youtube, Vimeo, Wistia etc)

    Metadata required to render will be sent in sgid_to_object_map

  • Image embeds

    Metadata required to render will be sent in inline_attachments

  • CodeBlocks

  • Horizontal Rule

  • Mention (inside a paragraph)

  • More to come

Understanding SGIDs in TipTap Blocks

What is SGID?

The sgid (Signed Global ID) attribute is a crucial component in TipTap blocks as it identifies elements within a block, such as an image, a file or even an user mention.

It acts as a pointer to specific metadata within the block, so the sgid value corresponds to an entry in the sgids_to_object_map, where the more detailed metadata is present

How It Works

  1. Within a TipTap block, you'll find an attrs.sgid value.

  2. To retrieve the associated metadata:

    • Look up this sgid value in the sgids_to_object_map object.

    • The corresponding entry provides detailed information about the referenced item.

Example Usage

Last updated