mui-extended
Version:
Extended UI Components built on Material UI
53 lines (52 loc) • 2.17 kB
TypeScript
import { IconButtonProps, TextareaAutosizeProps } from "@mui/material";
import { FunctionComponent, ReactNode } from "react";
export type MarkdownEditorMenuButtonAction = (name: string, content: string, selectionStart: number, selectionEnd: number) => {
content: string;
selectionStart: number;
selectionEnd: number;
};
export type MarkdownEditorMenuButtonProps = IconButtonProps;
export declare const MarkdownEditorMenuButton: FunctionComponent<MarkdownEditorMenuButtonProps & {
title: ReactNode;
}>;
export type MarkdownEditorMenuProps = {
onClick: (name: string) => void;
menu?: string[][];
menuButtons?: Record<string, FunctionComponent<MarkdownEditorMenuButtonProps>>;
disabled?: boolean;
};
export declare const MarkdownEditorMenu: FunctionComponent<MarkdownEditorMenuProps>;
export type MarkdownEditorViewType = "write" | "preview";
export type MarkdownEditorHeaderProps = MarkdownEditorMenuProps & {
hideTabs: boolean;
selectedView: MarkdownEditorViewType;
onViewChange: (selected: MarkdownEditorViewType) => void;
};
export declare const MarkdownEditorHeader: FunctionComponent<MarkdownEditorHeaderProps>;
export type MarkdownEditorContentProps = TextareaAutosizeProps & {
write: boolean;
preview: boolean;
};
export declare const MarkdownEditorContent: import("react").ForwardRefExoticComponent<Omit<MarkdownEditorContentProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
export type MarkdownEditorProps = TextareaAutosizeProps & {
inlinePreview?: boolean;
menuActions?: Record<string, MarkdownEditorMenuButtonAction>;
} & Pick<MarkdownEditorHeaderProps, "menu" | "menuButtons">;
/**
* RTE editor for markdown content
*
* can be used safely within the TextField
* - set `fullWidth` TextField to true
* - `shrink` label in TextField
* - inputRef points to Grid
*
* ```
* <TextField
* InputProps={{ inputComponent: MarkdownEditor }}
* InputLabelProps={{ shrink: true }}
* fullWidth
* />
* ```
*
*/
export declare const MarkdownEditor: import("react").ForwardRefExoticComponent<Omit<MarkdownEditorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;