feat: add imagevault images to RTE

This commit is contained in:
Christel Westerberg
2024-07-01 17:09:48 +02:00
parent 450160c2ba
commit 8956edbd2f
11 changed files with 577 additions and 33 deletions

View File

@@ -1,6 +1,8 @@
import { InsertResponse } from "../components/imageVaultImage"
import { RTEItemTypeEnum } from "./enums"
import type { EmbedTypesEnum, RTEItemType } from "./enums"
import type { Lang } from "@/constants/languages"
import type { EmbedTypesEnum, RTEItemType } from "./enums"
export interface Attributes {
[key: string]: any
@@ -36,3 +38,9 @@ export interface RTELinkAttrs extends Attributes {
target: HTMLAnchorElement["target"]
type: RTEItemTypeEnum.entry
}
export interface RTEImageVaultAttrs extends Attributes, InsertResponse {
height: string
width: string
style: string[]
}

View File

@@ -36,6 +36,7 @@ export enum RTETypeEnum {
thead = "thead",
tr = "tr",
ul = "ul",
ImageVault = "ImageVault",
}
export type RTEType = keyof typeof RTETypeEnum

View File

@@ -5,6 +5,7 @@ import type {
Attributes,
RTEAnchorAttrs,
RTEAssetAttrs,
RTEImageVaultAttrs,
RTELinkAttrs,
} from "./attrs"
import type { RenderOptions } from "./option"
@@ -36,6 +37,11 @@ export interface RTEReferenceLinkNode extends RTEDefaultNode {
attrs: RTELinkAttrs
}
export interface RTEImageVaultNode extends RTEDefaultNode {
attrs: RTEImageVaultAttrs
type: RTETypeEnum.ImageVault
}
export enum RTEMarkType {
bold = "bold",
break = "break",
@@ -58,9 +64,11 @@ export type RTETextNode = RTETextNodeOptionalKeys & {
text: string
}
export type RTERegularNode = RTEDefaultNode | RTEAnchorNode
export type RTERegularNode = RTEDefaultNode | RTEAnchorNode | RTEImageVaultNode
export type RTEReferenceNode = RTEDefaultNode | RTEAnchorNode
export type RTEImageNode = RTEDefaultNode | RTEImageVaultNode
export type RTEReferenceNode = RTEAnchorNode
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode