choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
61 lines (60 loc) • 2.51 kB
TypeScript
import React, { Component } from 'react';
import { Range, UnprivilegedEditor } from 'react-quill/lib';
import 'react-quill/dist/quill.snow.css';
import { DeltaOperation, DeltaStatic, Sources, StringMap } from './quill';
import { RichTextToolbarType } from './enum';
import { RichTextToolbarHook } from './RichText';
import DataSet from '../data-set/DataSet';
import Record from '../data-set/Record';
export interface BaseEditorProps {
dataSet?: DataSet;
record?: Record;
value: DeltaStatic;
saveRef?: Function;
onChange?: Function;
bounds?: string | HTMLElement;
children?: React.ReactElement<any>;
className?: string;
defaultValue?: string | DeltaStatic;
formats?: string[];
id?: string;
modules?: StringMap;
onChangeSelection?(selection: Range, source: Sources, editor: UnprivilegedEditor): void;
onFocus?(selection: Range, source: Sources, editor: UnprivilegedEditor): void;
onBlur?(previousSelection: Range, source: Sources, editor: UnprivilegedEditor): void;
onKeyDown?: React.EventHandler<any>;
onKeyPress?: React.EventHandler<any>;
onKeyUp?: React.EventHandler<any>;
placeholder?: string;
preserveWhitespace?: boolean;
readOnly?: boolean;
scrollingContainer?: string | HTMLElement;
style?: React.CSSProperties;
tabIndex?: number;
theme?: string;
autoFocus?: boolean;
mode?: 'preview' | 'editor';
toolbarId?: string;
toolbar?: RichTextToolbarType | RichTextToolbarHook;
}
export default class BaseEditor extends Component<BaseEditorProps> {
state: {
imgOpen: boolean;
images: never[];
srcIndex: number;
};
editor: any;
deltaOps?: DeltaOperation[];
setValue(value: any): void;
handleRichTextChange(_: any, __: any, ___: any, editor: UnprivilegedEditor): void;
componentDidUpdate(): void;
getOtherProps(): Pick<Readonly<BaseEditorProps> & Readonly<{
children?: React.ReactNode;
}>, "children" | "dataSet" | "readOnly" | "record" | "id" | "theme" | "mode" | "onKeyDown" | "onKeyUp" | "onKeyPress" | "onFocus" | "onBlur" | "tabIndex" | "autoFocus" | "placeholder" | "saveRef" | "bounds" | "formats" | "modules" | "onChangeSelection" | "preserveWhitespace" | "scrollingContainer" | "toolbarId">;
handleOpenLightBox: (e: any) => void;
componentWillUnmount(): void;
componentDidMount(): void;
renderContent(): JSX.Element | undefined;
render(): JSX.Element;
saveRef: (name: any) => (ref: any) => void;
}