Composition / foldkit-composition/richtext

RichTextBlock

namespace · packages/composition/src/richtext/index.ts:14

const RichTextBlock = { define }

Members

RichTextBlock.define

function · packages/composition/src/richtext/index.ts:19

define<const Name extends string>(name: Name, config: {
    readonly kit: RichText.Kit;
    readonly provides: ReadonlyArray<Content>;
}): Block<Name, Schema.Struct<{ readonly body: Schema.Struct<{ readonly version: Schema.Literal<1>; readonly children: Schema.$Array<Schema.Union<readonly [Schema.Struct<{ readonly type: Schema.Literal<"Paragraph">; readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">; readonly children: Schema.$Array<Schema.Struct<{ readonly type: Schema.Literal<"Text">; readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">; readonly text: Schema.String; readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{ readonly name: Schema.NonEmptyString; readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>; }>]>>; }>>; }>, Schema.Struct<{ readonly type: Schema.Literal<"Heading">; readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">; readonly level: Schema.Literals<readonly [1, 2, 3, 4, 5, 6]>; readonly children: Schema.$Array<Schema.Struct<{ readonly type: Schema.Literal<"Text">; readonly id: Schema.brand<Schema.NonEmptyString, "foldkit-richtext/NodeId">; readonly text: Schema.String; readonly marks: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.Struct<{ readonly name: Schema.NonEmptyString; readonly props: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>; }>]>>; }>>; }>, Schema.Struct<{ readonly type: Schema.Literal<"Node">; readonly kind: Schema.NonEmptyStrin …;

A Block whose one prop is body, a rich-text Document the Kit accepts: RichTextBlock.define('Text', { kit: ArticleKit, provides: [Content.Flow] }).