From ba7cd0798ae7cfdae487966a92f98c4db9025d76 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Fri, 29 Nov 2024 11:17:46 +0100 Subject: [PATCH] fix(SW-1035): Fixed issue when is returned from CS inside RTE --- components/JsonToHtml/renderOptions.tsx | 23 +++++++++++++++++++++++ types/transitionTypes/rte/enums.ts | 1 + 2 files changed, 24 insertions(+) diff --git a/components/JsonToHtml/renderOptions.tsx b/components/JsonToHtml/renderOptions.tsx index 845813508..5d16a3bc6 100644 --- a/components/JsonToHtml/renderOptions.tsx +++ b/components/JsonToHtml/renderOptions.tsx @@ -309,6 +309,29 @@ export const renderOptions: RenderOptions = { ) }, + [RTETypeEnum.span]: ( + node: RTEDefaultNode, + embeds: EmbedByUid, + next: RTENext, + fullRenderOptions: RenderOptions + ) => { + let props = extractPossibleAttributes(node.attrs) + const className = props.className + + if (className) { + if (hasAvailableULFormat(className)) { + // @ts-ignore: We want to set css modules classNames even if it does not correspond + // to an existing class in the module style sheet. Due to our css modules plugin for + // typescript, we cannot do this without the ts-ignore + props.className = styles[className] + } + } + + return ( + {next(node.children, embeds, fullRenderOptions)} + ) + }, + [RTETypeEnum.reference]: ( node: RTENode, embeds: EmbedByUid, diff --git a/types/transitionTypes/rte/enums.ts b/types/transitionTypes/rte/enums.ts index f4d6bd86c..29a76bf0d 100644 --- a/types/transitionTypes/rte/enums.ts +++ b/types/transitionTypes/rte/enums.ts @@ -27,6 +27,7 @@ export enum RTETypeEnum { ol = "ol", p = "p", reference = "reference", + span = "span", table = "table", tbody = "tbody", td = "td",