Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CONTENT-MODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ carries an optional **`access_tags`** field for content gating — see §4.5.

**`content` on the two paragraph types is an HTML rich-text field**, not a plain multiline box.
It is a Rich Text field (`allow_rich_text`, `rich_text_type: custom`, HTML output) on both
`cms_paragraph_component` and `cms_tab_paragraph_component`. Authors get bold, italic, lists and
links from the editor, and the storefront renders the resulting HTML.
`cms_paragraph_component` and `cms_tab_paragraph_component`. The editor toolbar offers headings
(H2–H6), bold, italic, underline, strikethrough, lists and links, and the storefront renders the
resulting HTML. Tables are not in the toolbar; the sanitizer keeps tables already present in
stored HTML.

Editor formatting that does **not** render, so do not rely on it:

Expand Down
1 change: 1 addition & 0 deletions import-export/starter-pack/content-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('starter pack content types (DX-31556)', () => {
expect(field.field_metadata.allow_rich_text).toBe(true);
expect(field.field_metadata.rich_text_type).toBe('custom');
expect(field.field_metadata.options).toContain('html');
expect(field.field_metadata.options).toEqual(expect.arrayContaining(['lists', 'h2', 'h3', 'h4', 'h5', 'h6']));
expect(field.field_metadata).not.toHaveProperty('markdown');
expect(field.field_metadata).not.toHaveProperty('multiline');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@
"italic",
"deleted",
"lists",
"link"
"link",
"h2",
"h3",
"h4",
"h5",
"h6"
],
"instruction": "The HTML body shown in the slot. Bold, italic, lists and links render; inline styles, embeds, iframes and scripts do not."
"instruction": "The HTML body shown in the slot. Toolbar: headings (H2-H6), bold, italic, underline, strikethrough, lists, links. Inline styles, embeds, iframes and scripts are removed on the storefront."
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@
"italic",
"deleted",
"lists",
"link"
"link",
"h2",
"h3",
"h4",
"h5",
"h6"
],
"instruction": "The HTML body shown in the slot. Bold, italic, lists and links render; inline styles, embeds, iframes and scripts do not."
"instruction": "The HTML body shown in the slot. Toolbar: headings (H2-H6), bold, italic, underline, strikethrough, lists, links. Inline styles, embeds, iframes and scripts are removed on the storefront."
}
},
{
Expand Down
16 changes: 9 additions & 7 deletions import-export/starter-pack/generate-content-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ const text = (uid, name, { instruction = '', multiline = false, multiple = false
display_name: name, uid, data_type: 'text', mandatory, unique: false, multiple,
non_localizable: nonLocalizable, field_metadata: { ...(multiline ? { multiline: true } : {}), instruction },
});
// HTML rich-text field (Contentstack's Rich Text editor, HTML output). Shape copied
// from the "Rich Text" field of a real stack export (kickstart-stack-seed page.json):
// data_type text + allow_rich_text + rich_text_type "custom" + the editor option set.
// No `multiline` (that is the plain-text box) and no `markdown`.
// HTML rich-text field (Contentstack's Rich Text editor, HTML output). Shape is the
// `rich_text` and `copy` fields in kickstart-stack-seed stack/content_types/page.json
// (https://github.com/contentstack/kickstart-stack-seed) combined: data_type text +
// allow_rich_text + rich_text_type "custom", with the list/link options from `rich_text`
// and the heading (h2-h6) options from `copy`. No `multiline` (that is the plain-text box)
// and no `markdown`.
const richText = (uid, name, { instruction = '', mandatory = false, nonLocalizable = false } = {}) => ({
display_name: name, uid, data_type: 'text', mandatory, unique: false, multiple: false,
non_localizable: nonLocalizable,
field_metadata: {
allow_rich_text: true, rich_text_type: 'custom',
options: ['html', 'bold', 'underline', 'italic', 'deleted', 'lists', 'link'], instruction,
options: ['html', 'bold', 'underline', 'italic', 'deleted', 'lists', 'link', 'h2', 'h3', 'h4', 'h5', 'h6'], instruction,
},
});
const number = (uid, name, { instruction = '', nonLocalizable = false } = {}) => ({
Expand Down Expand Up @@ -141,10 +143,10 @@ const contentTypes = [
[titleField('Heading shown above the carousel.'), text('products', 'Products', { multiple: true, instruction: 'SAP product codes (SKUs), one per value. Only the code is stored; OCC provides live price/stock/image.' }), accessTags()]),
ct('CMS Paragraph Component', 'cms_paragraph_component',
'Rich-text / HTML content block. SAP typeCode CMSParagraphComponent.',
[titleField('Internal name for this paragraph block.'), richText('content', 'Content', { instruction: 'The HTML body shown in the slot. Bold, italic, lists and links render; inline styles, embeds, iframes and scripts do not.' }), accessTags()]),
[titleField('Internal name for this paragraph block.'), richText('content', 'Content', { instruction: 'The HTML body shown in the slot. Toolbar: headings (H2-H6), bold, italic, underline, strikethrough, lists, links. Inline styles, embeds, iframes and scripts are removed on the storefront.' }), accessTags()]),
ct('CMS Tab Paragraph Component', 'cms_tab_paragraph_component',
'Rich-text / HTML content block, rendered the same way as CMS Paragraph Component (SAP registers both to its stock paragraph renderer). SAP typeCode CMSTabParagraphComponent.',
[titleField('Internal name for this tab content block.'), richText('content', 'Content', { instruction: 'The HTML body shown in the slot. Bold, italic, lists and links render; inline styles, embeds, iframes and scripts do not.' }), accessTags()]),
[titleField('Internal name for this tab content block.'), richText('content', 'Content', { instruction: 'The HTML body shown in the slot. Toolbar: headings (H2-H6), bold, italic, underline, strikethrough, lists, links. Inline styles, embeds, iframes and scripts are removed on the storefront.' }), accessTags()]),
ct('Media Container', 'media_container',
'A reusable per-breakpoint image set, referenced from the Media Container field on banner components so one asset set can back multiple banners. SAP typeCode MediaContainer.',
[titleField('Internal name for this media set.'),
Expand Down
Loading