import { BaseEditor, BaseText, Descendant } from 'slate'; import { ReactEditor } from 'slate-react'; import { HistoryEditor } from 'slate-history'; import { BLOCK_TAGS } from '../constants'; export type CustomElement = { type: ElementFormat; children: Descendant[]; align?: string; url?: string; htmlAttributes?: Record; }; export type CustomText = BaseText & { bold?: boolean; code?: boolean; italic?: boolean; underline?: boolean; superscript?: boolean; subscript?: boolean; strikethrough?: boolean; }; export type ElementFormat = (typeof BLOCK_TAGS)[keyof typeof BLOCK_TAGS]; declare module "slate" { interface CustomTypes { Editor: BaseEditor & ReactEditor & HistoryEditor; Element: CustomElement; Text: CustomText; } }