dmeditor
Version:
dmeditor is a block-style visual editor. Data is in json format.
78 lines (77 loc) • 3.27 kB
TypeScript
import React, { ReactNode } from 'react';
import { BaseText, Editor, Node, Element as SlateElement, type Descendant } from 'slate';
import { ReactEditor, RenderLeafProps } from 'slate-react';
interface BaseProps {
className: string;
[key: string]: unknown;
}
declare const Button: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<{
active: boolean;
reversed: boolean;
} & BaseProps>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
declare const ToolsGroup: (props: any) => import("react/jsx-runtime").JSX.Element;
declare const MarkButton: ({ format }: {
format: any;
}) => import("react/jsx-runtime").JSX.Element;
declare const BlockButton: ({ format }: {
format: any;
}) => import("react/jsx-runtime").JSX.Element;
export declare const isBlockActive: (editor: Editor, format: any, blockType?: string) => boolean;
declare const toggleMark: (editor: Editor, format: any) => void;
export declare const toggleBlock: (editor: any, format: any) => void;
declare const Toolbar: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<BaseProps>, "ref"> & React.RefAttributes<HTMLDivElement>>;
export declare const resetNodes: (editor: Editor, options?: {
nodes?: Node | Node[];
at?: Location;
}) => void;
declare const HoveringToolbar: () => import("react/jsx-runtime").JSX.Element;
interface ElementProps {
attributes: Record<string, unknown>;
children: ReactNode;
element: SlateElement;
}
declare const Element: (props: ElementProps) => import("react/jsx-runtime").JSX.Element;
interface MiniRichTextLeafProps extends RenderLeafProps {
attributes: RenderLeafProps['attributes'];
children: React.ReactNode;
leaf: {
bold: boolean;
code: boolean;
italic: boolean;
underline?: boolean;
'font-family': string;
'font-size': string;
color: string;
} & Pick<BaseText, 'text'>;
}
declare const Leaf: ({ attributes, children, leaf }: MiniRichTextLeafProps) => import("react/jsx-runtime").JSX.Element;
declare const InsertImageButton: (props: {
value: {
id: string;
src: string;
} | undefined;
}) => import("react/jsx-runtime").JSX.Element;
declare const isImageUrl: (url: string) => boolean;
declare const insertImage: (editor: ReactEditor, url: string, options?: {
inline?: boolean;
}) => void;
type LinkElement = {
type: 'link';
url: string;
target?: string;
children: Descendant[];
};
declare const isLinkActive: (editor: Editor) => boolean;
export declare const getLink: (editor: Editor) => {
link: string;
target?: string | undefined;
};
declare const unwrapLink: (editor: Editor) => void;
declare const wrapLink: (editor: Editor, url: string, openNew: boolean) => void;
interface withInsertDataEdtior extends ReactEditor {
insertData: (data: any) => void;
}
declare const withInlines: (editor: withInsertDataEdtior) => withInsertDataEdtior;
export declare const withImages: (editor: withInsertDataEdtior) => withInsertDataEdtior;
export { toggleMark, MarkButton, BlockButton, HoveringToolbar, Toolbar, Element, Leaf, InsertImageButton, Button, insertImage, isImageUrl, ToolsGroup, isLinkActive, wrapLink, unwrapLink, withInlines, };
export type { LinkElement, MiniRichTextLeafProps };