import React from "react";
import { BaseEditor, Editor } from "slate";
import { HistoryEditor } from "slate-history";
import { ReactEditor } from "slate-react";
import { Link } from "../../LinkEditorDialog";
import { Field } from "../../pageModel";
export type MarkId = keyof typeof SLATE_MARKS;
export type BlockId = keyof typeof SLATE_BLOCKS;
export type AlignmentId = keyof typeof SLATE_ALIGNMENTS;
export type MarkOptionConfig = {
    readonly type: "mark";
    readonly id: MarkId;
};
export type BlockOptionConfig = {
    readonly type: "block";
    readonly id: BlockId;
};
export type AlignmentOptionConfig = {
    readonly type: "alignment";
    readonly id: AlignmentId;
};
export type LinkOptionConfig = {
    readonly type: "link";
    readonly id: "link";
};
export type ListOptionConfig = {
    readonly type: "list";
    readonly id: "unordered-list" | "ordered-list";
};
export type DividerOptionConfig = {
    readonly type: "divider";
    readonly id: "divider";
};
export type InsertionOptionConfig = {
    readonly type: "insertion";
    readonly id: "horizontal-rule";
};
export type ToolbarOptionConfig = MarkOptionConfig | BlockOptionConfig | AlignmentOptionConfig | LinkOptionConfig | ListOptionConfig | DividerOptionConfig | InsertionOptionConfig;
declare module "slate" {
    interface CustomTypes {
        Editor: BaseEditor & ReactEditor & HistoryEditor & {
            isMarkActive(format: MarkId): boolean;
            toggleMark(format: MarkId): void;
            isBlockActive(format: BlockId): boolean;
            toggleBlock(format: BlockId): void;
            isAlignActive(align: Alignment): boolean;
            toggleAlign(align: Alignment): void;
            isLinkActive(): boolean;
            insertLink(options?: {
                onOpenLinkDialog?: (callback: (link: any) => void) => void;
            }): void;
            isListActive(listType?: "unordered" | "ordered"): boolean;
            toggleList(listType: "unordered" | "ordered"): void;
            indentList(): void;
            outdentList(): void;
            insertHorizontalRule(): void;
            stripFormatting(): void;
        };
        Element: CustomElement;
        Text: CustomText;
    }
}
export type CustomText = {
    readonly text: string;
    readonly bold?: boolean;
    readonly italic?: boolean;
    readonly underline?: boolean;
    readonly strikethrough?: boolean;
    readonly subscript?: boolean;
    readonly superscript?: boolean;
    readonly extrabold?: boolean;
    readonly isRawHtml?: boolean;
};
export type Alignment = "left" | "center" | "right" | "justify";
export type CustomElement = {
    readonly type: string;
    readonly align?: Alignment;
    readonly listType?: "unordered" | "ordered";
    readonly indent?: number;
    readonly children: readonly (CustomText | CustomElement)[];
    readonly [key: string]: any;
};
export type PreservedElement = CustomElement & {
    readonly type: "preserved-element";
    readonly originalTag: string;
    readonly originalHtml: string;
    readonly attributes: Record<string, any>;
};
export type PreservedInlineElement = CustomElement & {
    readonly type: "preserved-inline";
    readonly originalTag: string;
    readonly originalHtml: string;
    readonly attributes: Record<string, any>;
};
export type LinkElement = CustomElement & {
    readonly type: "link";
    readonly link: Link;
};
export interface ReactSlateProps {
    readonly value?: string;
    readonly onChange?: (value: string) => void;
    readonly onFocus?: () => void;
    readonly onBlur?: () => void;
    readonly onMouseUp?: () => void;
    readonly onKeyUp?: () => void;
    readonly onContextMenu?: (event: React.MouseEvent<HTMLDivElement>) => void;
    readonly readOnly?: boolean;
    readonly placeholder?: string;
    readonly className?: string;
    readonly profile?: RichTextEditorProfile;
    readonly showControls?: boolean;
}
export interface CustomOption {
    readonly id: string;
    readonly label?: string;
    readonly icon?: React.ReactNode;
    readonly isActive?: (editor: Editor) => boolean;
    readonly toggle?: (editor: Editor, event: React.MouseEvent) => void;
}
export type DropdownOption<T = CustomOption> = {
    readonly value: T;
    readonly label?: string;
    readonly icon?: React.ReactNode;
    readonly style?: React.CSSProperties;
    readonly isActive: (editor: Editor) => boolean;
    readonly onSelect: (editor: Editor, event: React.MouseEvent) => void;
};
export interface ToolbarButtonProps {
    readonly icon: React.ReactNode;
    readonly active: boolean;
    readonly disabled?: boolean;
    readonly onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;
    readonly type?: string;
}
export interface ToolbarGroupConfig {
    readonly id: string;
    readonly label?: string;
    readonly display?: "buttons" | "dropdown";
    readonly showIconsOnly?: boolean;
    readonly options: readonly ToolbarOptionConfig[];
    readonly row?: number;
}
export type RichTextEditorProfile = {
    readonly toolbar: {
        readonly groups: readonly ToolbarGroupConfig[];
    };
};
export interface SimplifiedProfile {
    readonly marks: readonly MarkId[];
    readonly blocks: readonly BlockId[];
    readonly alignment: readonly AlignmentId[];
    readonly lists: boolean;
    readonly links: boolean;
}
export declare const SLATE_MARKS: {
    readonly bold: {
        readonly hotkey: "mod+b";
        readonly htmlTag: "strong";
        readonly label: "Bold";
        readonly icon: "𝐁";
        readonly renderHtml: (text: string) => string;
    };
    readonly italic: {
        readonly hotkey: "mod+i";
        readonly htmlTag: "em";
        readonly label: "Italic";
        readonly icon: "𝐼";
        readonly renderHtml: (text: string) => string;
    };
    readonly underline: {
        readonly hotkey: "mod+u";
        readonly htmlTag: "u";
        readonly label: "Underline";
        readonly icon: "𝐔";
        readonly renderHtml: (text: string) => string;
    };
    readonly strikethrough: {
        readonly htmlTag: "s";
        readonly label: "Strikethrough";
        readonly icon: "𝐒";
        readonly renderHtml: (text: string) => string;
    };
    readonly subscript: {
        readonly htmlTag: "sub";
        readonly label: "Subscript";
        readonly icon: "X₂";
        readonly renderHtml: (text: string) => string;
    };
    readonly superscript: {
        readonly htmlTag: "sup";
        readonly label: "Superscript";
        readonly icon: "X²";
        readonly renderHtml: (text: string) => string;
    };
    readonly extrabold: {
        readonly htmlTag: "span";
        readonly label: "Extra Bold";
        readonly icon: "𝐄𝐁";
        readonly renderHtml: (text: string) => string;
    };
};
export declare const SLATE_BLOCKS: {
    readonly paragraph: {
        readonly htmlTag: "p";
        readonly label: "Paragraph";
        readonly icon: "¶";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "no-tag": {
        readonly htmlTag: "no-tag";
        readonly label: "Plain Text";
        readonly icon: "T";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-1": {
        readonly htmlTag: "h1";
        readonly label: "Heading 1";
        readonly icon: "H1";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-2": {
        readonly htmlTag: "h2";
        readonly label: "Heading 2";
        readonly icon: "H2";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-3": {
        readonly htmlTag: "h3";
        readonly label: "Heading 3";
        readonly icon: "H3";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-4": {
        readonly htmlTag: "h4";
        readonly label: "Heading 4";
        readonly icon: "H4";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-5": {
        readonly htmlTag: "h5";
        readonly label: "Heading 5";
        readonly icon: "H5";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
    readonly "heading-6": {
        readonly htmlTag: "h6";
        readonly label: "Heading 6";
        readonly icon: "H6";
        readonly renderHtml: (text: string, alignStyle: string) => string;
    };
};
export declare const SLATE_ALIGNMENTS: {
    readonly left: {
        readonly label: "Align Left";
        readonly icon: "←";
        readonly value: "left";
    };
    readonly center: {
        readonly label: "Align Center";
        readonly icon: "↔";
        readonly value: "center";
    };
    readonly right: {
        readonly label: "Align Right";
        readonly icon: "→";
        readonly value: "right";
    };
    readonly justify: {
        readonly label: "Justify";
        readonly icon: "≡";
        readonly value: "justify";
    };
};
export type RichTextField = Field & {
    readonly source: string;
};
