@flowup/rich-text-types
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    rich-text-types

    Type definitions for rich text fields for Headless.

    Installation

    npm i [-D] @flowup/rich-text-types

    Usage

    Use Typescript type annotations:

    import { RichTextDocument } from '@flowup/rich-text-types';
     
    const document: RichTextDocument = {
      type: 'document',
      children: [
        {
          type: 'paragraph',
          children: [{ type: 'text', value: 'Hello, world.' }],
        },
      ],
    };

    Use JSON schema (e.g. for runtime validation):

    import { richTextSchema } from '@flowup/rich-text-types';
    import { validate } from 'jsonschema';
     
    console.log(
      validate(
        {
          type: 'document',
          children: [
            {
              type: 'heading-1',
              children: [{ type: 'text', value: 'Hello, world!' }],
            },
          ],
        },
        richTextSchema,
      ),
    );

    Keywords

    none

    Install

    npm i @flowup/rich-text-types

    DownloadsWeekly Downloads

    9

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    32.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar