59 lines
1.0 KiB
TypeScript
59 lines
1.0 KiB
TypeScript
export const rteType = {
|
|
asset: "asset",
|
|
p: "p",
|
|
reference: "reference",
|
|
}
|
|
|
|
export enum RTETypeEnum {
|
|
asset = "asset",
|
|
p = "p",
|
|
reference = "reference",
|
|
}
|
|
|
|
export type RTEType = keyof typeof rteType
|
|
|
|
export type RTEText = {
|
|
text: string
|
|
}
|
|
|
|
export type RTEAssetAttrs = {
|
|
"alt": string
|
|
"asset-alt": string
|
|
"asset-link": string
|
|
"asset-name": string
|
|
"asset-type": "image/png" | "image/jpg" | "image/jpeg"
|
|
"asset-uid": string
|
|
"display-type": "display"
|
|
"class-name": string
|
|
"content-type-uid": "sys_assets"
|
|
"inline": false
|
|
"type": RTETypeEnum.asset
|
|
}
|
|
|
|
type RTEBaseObject<T> = {
|
|
type: T
|
|
uid: string
|
|
}
|
|
|
|
type AssetReferenceObject = RTEBaseObject<RTETypeEnum.reference> & {
|
|
attrs: RTEAssetAttrs
|
|
children: RTEText[]
|
|
}
|
|
|
|
export type RTEObject =
|
|
| AssetReferenceObject
|
|
| {
|
|
attrs: Record<string, any>
|
|
children: (RTEObject | RTEText)[]
|
|
type: RTEType
|
|
uid: string
|
|
}
|
|
|
|
export type RTERootObject = {
|
|
attrs: RTEAssetAttrs | Record<string, any>
|
|
children: RTEObject[]
|
|
uid: string
|
|
type: "doc"
|
|
_version: number
|
|
}
|