uxEditor 所产生的数据是一系列内容项目的组合,简单的将一个完整的内容包含 :标题、文本、图片、链接等基本元素,这些元素在数据层面以 UXEditorItem 对象存储,最终组合为一个数组 UXEditorItem[],从而形成一个完整的内容。
在整个业务过程中我们还封装了多个数据类型,请阅读下面的介绍。
UXEditorItem 类型用于存储内容项目数据,格式如下 :
export type UXEditorItem = {
type:string
content:string
// 1 临时文件, 2 上传成功 3 上传错误
uploadStatus:number
}| 类型 | 作用 |
|---|---|
| h | 标题 |
| p | 段落文本 |
| strong | 加粗文本 |
| italic | 倾斜文本 |
| center | 居中文本 |
| blockquote | 引用文本 |
| img | 图片 |
| a | 链接 |
| hr | 分割线 |
UXEditorItemForSubmit 是提交数据时,的项目基础数据类型,格式 :
export type UXEditorItemForSubmit = {
type:string
content:string
}
UXEditorNeedUploadItem 是在提交时获取的需要上传的图片项目数据类型,格式:
export type UXEditorNeedUploadItem = {
index:number
tmpPath:string
}UXEditorResponse 是统一的 API 接口返回数据的类型,格式:
export type UXEditorNeedUploadItem = {
index:number
tmpPath:string
}