import { BaseEditor, BasePoint, BaseRange, BaseSelection, Descendant as SlateDescendant, Element as SlateElement, Location as SlateLocation, Operation as SlateOperation, Path as SlatePath, Range as SlateRange, Selection as SlateSelection } from "slate"; import { ReactEditor, RenderElementProps as SlateRenderElementProps } from "slate-react"; import { HistoryEditor } from "slate-history"; import { InjectedProps } from "material-ui-popup-state"; import { ReactNode } from "react"; export * from "./BxxSlateEditor"; export { DefaultLeaf } from "./SlateElement/LeafElement" export * from "slate" export * from "slate-react" export type Range = SlateRange export type Path = SlatePath export type Location = SlateLocation export type Element = SlateElement export type Selection = SlateSelection export type Descendant = SlateDescendant declare module "slate" { export type HoverToolbarProps = { enableFormatText?: boolean enableTextDecoration?: boolean enableColor?: boolean enableTextAlign?: boolean enableLink?: boolean renderMoreAction?: ( parentPopupState: InjectedProps, onOpen: (popupState: InjectedProps) => void, ) => ReactNode } export type ElementAlign = "left" | "center" | "right" | "justify" export type ElementFontStyle = "bold" | "italic" | "code" | "selected" export type ElementColorStyle = "colorText" | "colorFill" | "colorBorder" export type ElementDecorationStyle = "underlineStyle" | "underlineColor" | "underlineLine" | "strikethroughStyle" | "strikethroughColor" | "strikethroughLine" export type CustomElementMarker = { [key: string]: unknown; } export type ElementMarker = CustomElementMarker & Partial> & Partial> & Partial> & Partial> export type CustomOperation = { type: "custom_op" value: string } export type BaseSlateElement = { id?: string } export type CustomText = { placeholder?: string text: string } & BaseSlateElement & ElementMarker export type EmptyText = { text: "" } & Omit export type ParagraphElement = { type: "paragraph" children: CustomText[] } & BaseSlateElement & ElementMarker export type H1Element = { type: "h1" children: CustomText[] } & BaseSlateElement & ElementMarker export type H2Element = { type: "h2" children: CustomText[] } & BaseSlateElement & ElementMarker export type H3Element = { type: "h3" children: CustomText[] } & BaseSlateElement & ElementMarker export type H4Element = { type: "h4" children: CustomText[] } & BaseSlateElement & ElementMarker export type H5Element = { type: "h5" children: CustomText[] } & BaseSlateElement & ElementMarker export type H6Element = { type: "h6" children: CustomText[] } & BaseSlateElement & ElementMarker export type ListItemElement = { type: "list-item" children: SlateDescendant[] } & BaseSlateElement & Omit export type NumberedListElement = { type: "numbered-list" children: ListItemElement[] } & BaseSlateElement export type BulletedListElement = { type: "bulleted-list" children: ListItemElement[] } & BaseSlateElement export type BlockQuoteElement = { type: "block-quote" children: CustomText[] } & BaseSlateElement & ElementMarker export type CheckListItemElement = { type: "check-list-item" checked?: boolean children: CustomText[] } & BaseSlateElement & ElementMarker export type LinkElement = { type: "link" url: string; children: CustomText[] } & BaseSlateElement & ElementMarker export type ImageElement = { type: "image" url?: string children: EmptyText[] } & BaseSlateElement export type VideoElement = { type: "video" url?: string; children: EmptyText[] } & BaseSlateElement export type CodeLineElement = { type: "code-line" children: CustomText[] } & BaseSlateElement export type CodeBlockElement = { type: "code-block" language?: string children: CodeLineElement[] } & BaseSlateElement export type TableCellElement = { type: "table-cell" children: CustomText[] } & BaseSlateElement & ElementMarker export type TableRowElement = { type: "table-row" children: TableCellElement[] } & BaseSlateElement export type TableBodyElement = { type: "table-body" header?: boolean children: TableRowElement[] } & BaseSlateElement export type TableElement = { type: "table" title?: string children: TableBodyElement[] } & BaseSlateElement export type MentionElement = { type: "mention" character: string children: EmptyText[] } & BaseSlateElement export type DividerElement = { type: "divider" children: EmptyText[] } & BaseSlateElement export type CustomElement = | ParagraphElement | H1Element | H2Element | H3Element | H4Element | H5Element | H6Element | NumberedListElement | BulletedListElement | ListItemElement | BlockQuoteElement | CheckListItemElement | LinkElement | ImageElement | VideoElement | CodeBlockElement | CodeLineElement | TableElement | TableBodyElement | TableRowElement | TableCellElement | MentionElement | DividerElement export type CustomEditor = BaseEditor & ReactEditor & HistoryEditor & { nodeToDecorations?: Map } export type CustomRenderElementProps = { element: T } & Partial interface CustomTypes { Editor: CustomEditor; Element: CustomElement; Text: CustomText | EmptyText; Node: CustomElement | CustomText; Point: BasePoint; Selection: BaseSelection; Operation: typeof SlateOperation | CustomOperation; Range: BaseRange & { [key: string]: unknown }; } } declare module "slate-react" { interface CustomTypes { RenderElementProps: CustomRenderElementProps; } }