/// import type { BaseEditor, NodeEntry } from 'slate'; import type { HistoryEditor } from 'slate-history'; import type { ReactEditor, RenderElementProps as SlateRenderElementProps, RenderLeafProps as SlateRenderLeafProps } from 'slate-react'; import type { Mode } from '../core'; export declare type _RichTextLeaf = { text: string; bold?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; }; declare type RichTextParagraph = { type: 'paragraph'; }; declare type RichTextHeading = { type: 'heading'; level: number; }; declare type RichTextQuote = { type: 'quote'; }; declare type RichTextNumberedList = { type: 'numbered-list'; }; declare type RichTextBulletedList = { type: 'bulleted-list'; }; declare type RichTextListItem = { type: 'list-item'; }; export declare type _RichTextLink = { type: 'link'; url: string; children: _RichTextNode[]; }; export declare type DTRNode = { type: 'dtr'; id: number; queryParam: string; method: DTRSettings['method']; children: _RichTextNode[]; }; export declare type NewLineItem = { type: 'new-line'; children: _RichTextNode[]; }; export declare type _RichTextElementType = { children: _RichTextNode[]; } & (RichTextParagraph | RichTextQuote | _RichTextLink | RichTextNumberedList | RichTextBulletedList | RichTextListItem | RichTextHeading | DTRNode | NewLineItem); export declare type _RichTextNode = _RichTextElementType | _RichTextLeaf; export declare type RenderElementProps = SlateRenderElementProps & { element: _RichTextElementType; mode: Mode; }; export declare type RenderLeafProps = SlateRenderLeafProps & { leaf: _RichTextLeaf; }; export declare type RichTextLeafMark = keyof Omit<_RichTextLeaf, 'text'>; export declare type ListType = 'bulleted-list' | 'numbered-list'; export interface ToolbarControl { format: RichTextLeafMark | 'link' | 'dtr' | ListType; icon: JSX.Element | string; } export declare type RichTextEditor = BaseEditor & ReactEditor & { blurSelection: ReactEditor['selection']; blurSelectedText?: string; } & HistoryEditor; export declare type RichText = _RichTextNode[]; declare module 'slate' { interface CustomTypes { Editor: RichTextEditor; Element: _RichTextElementType; Text: _RichTextLeaf; } } export declare type MatchReturn = Generator, void, undefined>; export declare type TextNodeType = 'link' | 'dtr'; export declare type TextControlOptions = TextNodeType | ''; export declare type DTRSettingOptions = 'queryParam' | 'defaultText' | 'textStyle'; export declare type DTRSettings = { queryParam: string; defaultText: string; method: 'uppercase' | 'lowercase' | 'titlecase' | 'capitalized' | ''; }; export interface RichTextControlOptions { bold: boolean; italic: boolean; underline: boolean; strikethrough: boolean; dtr: boolean; link: boolean; bulletedList: boolean; numberedList: boolean; } export {};