UNPKG

@rtdui/editor

Version:

React rich text editor based on tiptap

47 lines (46 loc) 1.21 kB
import { Node } from "@tiptap/core"; export interface ImageOptions { inline: boolean; /** * 用户是否可以拖拉缩放图片 */ resizable: boolean; /** * 上传的url */ url: string; /** * 文件上传时使用的HTTP Method */ method: string; /** * 图片的最大宽度约束, 原图片超出该宽度会自动压缩, 默认320 */ maxWidth: number; /** * 图片的最大高度约束, 原图片超出该高度会自动压缩, 默认180 */ maxHeight: number; /** * 压缩后的文件的输出质量, 取值范围0-1,默认0.7 */ quality: number; HTMLAttributes: Record<string, any>; } declare module "@tiptap/core" { interface Commands<ReturnType> { image: { setImage: (options: { src: string; alt?: string; title?: string; }) => ReturnType; uploadImage: (options: { alt?: string; title?: string; }) => ReturnType; }; } } export declare const inputRegex: RegExp; export declare const UploadImageWithResizable: Node<ImageOptions, any>;