/// import { RichText as WordPressRichText } from "@wordpress/block-editor"; import BlockInstruction from "../../../core/blocks/BlockInstruction"; import { RenderSaveProps, RenderEditProps } from "../../../core/blocks/BlockDefinition"; import BlockLeaf from "../../../core/blocks/BlockLeaf"; import { BlockConfiguration } from "@wordpress/blocks"; export interface RichTextSaveProps extends WordPressRichText.ContentProps { "data-id": string; } export interface RichTextEditProps extends WordPressRichText.Props { "data-id": string; } /** * RichTextBase instruction. */ export default abstract class RichTextBase extends BlockInstruction { options: { name: string; default: string; placeholder: string; keepPlaceholderOnFocus?: boolean; required?: boolean; }; /** * Renders saving the rich text. * * @param props The render props. * @param leaf The leaf being rendered. * @param i The number child this is. * * @returns The RichText element. */ save(props: RenderSaveProps, leaf: BlockLeaf, i: number): JSX.Element; /** * Renders editing the rich text. * * @param props The render props. * @param leaf The leaf being rendered. * @param i The number child this is. * * @returns The RichText element. */ edit(props: RenderEditProps, leaf: BlockLeaf, i: number): JSX.Element; /** * Adds the RichText attributes to the block configuration. * * @returns The block configuration. */ configuration(): Partial; /** * Gets the base attributes of the rich text. * * @param props The props. * @param i The number child this is. * * @returns The base attributes. */ protected abstract getBaseAttributes(props: RenderSaveProps | RenderEditProps, i: number): RichTextSaveProps | RichTextEditProps; }