Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions src/PrismicRichText.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import {
cloneElement,
type ComponentType,
type FC,
Fragment,
isValidElement,
type ReactNode,
} from "react";
import { type LinkProps, PrismicLink } from "./PrismicLink.js";
import { devMsg } from "./lib/devMsg.js";
import {
isFilled,
type LinkResolverFunction,
Expand All @@ -20,10 +14,14 @@ import {
type RichTextMapSerializer,
} from "@prismicio/client/richtext";
import { DEV } from "esm-env";

import { devMsg } from "./lib/devMsg.js";

import { type LinkProps, PrismicLink } from "./PrismicLink.js";
import {
cloneElement,
type ComponentType,
type FC,
Fragment,
isValidElement,
type ReactNode,
} from "react";

/**
* A function mapping rich text block types to React Components. It is used to
Expand All @@ -39,7 +37,12 @@ export type JSXFunctionSerializer = RichTextFunctionSerializer<ReactNode>;
*
* @see Templating rich text fields {@link https://prismic.io/docs/fields/rich-text}
*/
export type JSXMapSerializer = RichTextMapSerializer<ReactNode>;
export type RichTextComponents = RichTextMapSerializer<ReactNode>;

/**
* @deprecated Use `RichTextComponents` instead.
*/
export type JSXMapSerializer = RichTextComponents;

/** Props for `<PrismicRichText>`. */
export type PrismicRichTextProps = {
Expand Down Expand Up @@ -84,7 +87,7 @@ export type PrismicRichTextProps = {
* };
* ```
*/
components?: JSXMapSerializer | JSXFunctionSerializer;
components?: RichTextComponents | JSXFunctionSerializer;

/**
* The React component rendered for links when the URL is internal.
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type { PrismicTextProps } from "./PrismicText.js";
export { PrismicRichText } from "./PrismicRichText.js";
export type {
PrismicRichTextProps,
RichTextComponents,
JSXMapSerializer,
JSXFunctionSerializer,
} from "./PrismicRichText.js";
Expand Down