import { RefObject } from 'react'; import { DefaultRenderElementProps, OnlyEditorPlugin, DefaultRenderLeafProps, DefaultElement } from "./type"; import { ReactEditor } from 'slate-react'; interface RenderElementPayload { readonly?: boolean; maxWidth?: number; } declare class Utils { private protocolAndDomainRE; private localhostDomainRE; private nonLocalhostDomainRE; renderElement(props: DefaultRenderElementProps, plugins: OnlyEditorPlugin[], payload: RenderElementPayload): JSX.Element; renderLeaf(props: DefaultRenderLeafProps, plugins: OnlyEditorPlugin[]): JSX.Element; onKeydown(event: KeyboardEvent, editor: ReactEditor, plugins: OnlyEditorPlugin[]): boolean; pipe(x: any, ...fns: any[]): any; getUUid(): string; classNames: (...args: any) => string; /** * 将 dataURI 转换成 blob */ dataURItoBlob(dataURI: string): Blob; isUrl: (string: string) => boolean; /** * 生成 type 链表 */ generatorTypeLink(types: DefaultElement['type'][]): { [key: string]: { prev: DefaultElement['type']; next: DefaultElement['type']; }; }; encode(value: DefaultElement[]): string; decode(text: string): DefaultElement[]; /** * 获取弹出框(popup)的位置 * @param triggerRef 触发时的 dom ref(计算后的位置在此元素的下方) * @param contentAttr popup 的内容最大宽高 * @param relativeRef 最近一级的 relative 定位元素,默认为 body * @param offset 定位偏移量 * @param scrollElement popup 的可滚动容器 */ getPopupPosition(triggerRef: RefObject, contentAttr: { width: number; height: number; }, relativeRef?: RefObject, offset?: { left: number; top: number; }, scrollElement?: HTMLDivElement): { top: number; left: number; }; } export declare const utils: Utils; export {};