fix: refactor use of tokens

This commit is contained in:
Christel Westerberg
2024-05-21 15:17:12 +02:00
parent ad343aa666
commit a19b0687bb
8 changed files with 60 additions and 125 deletions

View File

@@ -253,7 +253,7 @@ export const renderOptions: RenderOptions = {
const type = node.attrs.type
if (type === RTEItemTypeEnum.asset) {
const image = embeds?.[node?.attrs?.["asset-uid"]]
if (image.node.__typename === EmbedEnum.SysAsset) {
if (image?.node.__typename === EmbedEnum.SysAsset) {
const alt = image?.node?.title ?? node.attrs.alt
const alignment = node.attrs?.style?.["text-align"]
? {

View File

@@ -14,7 +14,7 @@ import type { RenderOptions } from "@/types/rte/option"
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => {
if (embed.node.system.uid) {
if (embed.node.system?.uid) {
acc[embed.node.system.uid] = embed
}
return acc