import type { Api, ReactPropsBase } from 'jamis-core'; import type { Delta, Range } from 'quill'; import type { CSSProperties } from 'react'; import type { FormBaseControlSchema, FormControlProps, FormItemProps } from '../types'; export interface RichTextControlSchema extends FormBaseControlSchema { type: 'input-rich-text'; /** * 图片保存 API * * @default /api/upload/image */ receiver?: Api; /** * 视频保存 API * * @default /api/upload/video */ videoReceiver?: Api; /** * 接收器的字段名 */ fileField?: string; } export interface RichTextControlSchemaV1 extends FormBaseControlSchema { type: 'input-rich-text-v1'; /** * 编辑器类型 */ vendor?: 'froala' | 'tinymce'; /** * 图片保存 API * * @default /api/upload/image */ receiver?: Api; /** * 视频保存 API * * @default /api/upload/video */ videoReceiver?: Api; /** * 接收器的字段名 */ fileField?: string; /** * 边框模式,全边框或者没边框。 */ borderMode?: 'full' | 'half' | 'none'; /** * tinymce 或 froala 的配置 */ options?: any; } export interface RichTextProps extends FormControlProps { options?: any; vendor?: 'froala' | 'tinymce'; } export interface QuillEditorProps extends ReactPropsBase { readOnly?: boolean; defaultValue?: string; placeholder?: string; onTextChange?: (delta: Delta, content: string) => void; onSelectionChange: (range: Range) => void; onImageUpload?: (file: File) => Promise<{ url: string; style?: CSSProperties; } | null>; } export interface QuillEditorRendererProps extends FormItemProps { fileField?: string; receiver?: Api; }