From cab7916b90d118f5dcffcdb7d6a2c1bf6c5e5a35 Mon Sep 17 00:00:00 2001 From: tromesh Date: Fri, 7 Nov 2025 22:06:56 +0100 Subject: [PATCH] CMS-46488 Enhance RichText documentation and update renderer to remove SVG support --- docs/6.1-richtext-component-react.md | 14 +++++++++++--- .../src/components/richText/renderer.ts | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/6.1-richtext-component-react.md b/docs/6.1-richtext-component-react.md index 7f6cde11..3ed551a2 100644 --- a/docs/6.1-richtext-component-react.md +++ b/docs/6.1-richtext-component-react.md @@ -58,9 +58,17 @@ Custom React components for rendering specific element types. Allows you to over - **Headings:** `heading-one`, `heading-two`, `heading-three`, `heading-four`, `heading-five`, `heading-six` - **Text blocks:** `paragraph`, `quote`, `pre`, `div` - **Lists:** `bulleted-list`, `numbered-list`, `list-item` -- **Inline:** `link`, `code`, `mark`, `sup`, `sub`, `ins`, `del`, `br` -- **Tables:** `table`, `tbody`, `tr`, `th`, `td` -- **Media:** `image` +- **Text semantics (inline):** `span`, `mark`, `strong`, `em`, `u`, `s`, `i`, `b`, `small`, `sub`, `sup`, `ins`, `del`, `kbd`, `abbr`, `cite`, `dfn`, `q`, `data`, `bdo`, `bdi` +- **Code-related:** `code`, `pre`, `var`, `samp` +- **Links & Interactive:** `link`, `a`, `button`, `label` +- **Tables:** `table`, `thead`, `tbody`, `tfoot`, `caption`, `tr`, `th`, `td` +- **Media:** `image`, `img`, `canvas` +- **Forms:** `input`, `select`, `option`, `textarea` +- **Other:** `br`, `wbr` + +> [!NOTE] > **SVG elements are not supported by default.** SVG requires specialized child elements (`circle`, `path`, `rect`, etc.) and attributes that would require extensive additional support. +> +> **Alternatives:** Use custom element handlers, upload SVG as image assets, or create dedicated React components. #### Example: Custom Elements diff --git a/packages/optimizely-cms-sdk/src/components/richText/renderer.ts b/packages/optimizely-cms-sdk/src/components/richText/renderer.ts index 66304963..eadd8ea6 100644 --- a/packages/optimizely-cms-sdk/src/components/richText/renderer.ts +++ b/packages/optimizely-cms-sdk/src/components/richText/renderer.ts @@ -494,7 +494,6 @@ export const defaultElementTypeMap: Record< // Media (when inline) image: { tag: 'img', config: { selfClosing: true } }, img: { tag: 'img', config: { selfClosing: true } }, - svg: { tag: 'svg' }, canvas: { tag: 'canvas' }, // Form elements