import type { PropsWithData } from "../../helpers/PropsWithData.js"; import type { BlockTypeTextProps } from "../BlockText.js"; import type { RichTextInlineRenderer, RichTextLinkHrefResolver } from "../common.js"; export interface TipTapRichTextBlockData { /** Tip-Tap content (`{ type: "doc", content: [...] }`), as produced by the CMS TipTapRichText block. */ tipTapContent: unknown; } export type TipTapRichTextBlockProps = PropsWithData; export interface CreateTipTapRichTextBlockOptions = Record> { /** Default look per text block or list, used when the editor picks no style, e.g. `{ "unordered-list": { variant: "list" } }`. */ textBlocks?: Record; /** Look per style the editor picks, e.g. `{ title: { variant: "title" } }`. Wins over `textBlocks`. */ textBlockStyles?: Record; /** * Maps the application's link block types within `link` marks to a resolver * returning the link's href. * * Merged on top of the built-in `external` link type. Link types without a * resolver render their text without a link. */ linkTypes?: { [TLinkType in keyof TLinkTypes]: RichTextLinkHrefResolver; }; /** * Maps Tip-Tap mark types to renderers, keyed by the mark's `type`. * * Merged on top of the built-in marks (`bold`, `italic`, `underline`, * `strike`, `superscript`, `subscript`): use it to override a built-in mark, * or to render a mark the application adds. */ marks?: Record; /** * Maps the inline styles the application defines in its RTE — the * `inlineStyles` option of the CMS TipTapRichText block — to renderers. * * Has no built-ins: an inline style this option does not name renders its * text unchanged. */ inlineStyles?: Record; }