Repository navigation
feat(starter-pack): rich-text editing for SAP paragraph content (DX-31554) - #29
vaishnavi-kedar-cstk wants to merge 8 commits into
Conversation
Make the `content` field of cms_paragraph_component and cms_tab_paragraph_component an HTML rich-text field (allow_rich_text, rich_text_type "custom", html option set) instead of a multiline text box. Generated by generate-content-types.mjs; no other content type changes. Adds TC-1 spec asserting the rich-text shape and that the shipped content_types/*.json equal the generator output. Refs: DX-31556 Co-authored-by: Claude <noreply@anthropic.com>
Document that the Content field of cms_paragraph_component and cms_tab_paragraph_component is HTML rich text, list the editor formatting that does not render (inline styles, embeds, iframes, scripts), and note that the generator is the source of truth when the docs and pack differ. Note that stacks which already imported the pack are not updated. Refs: DX-31556 Co-authored-by: Claude <noreply@anthropic.com>
…ph-rich-text-fields feat(starter-pack): paragraph Content fields as HTML rich text (DX-31556)
Register CMSTabParagraphComponent to ContentstackEditableParagraphComponent beside CMSParagraphComponent so tab paragraphs get the same markup and the preview-only field-level data-cslp tag. Adds mapper, module-registration and renderer specs (TestBed specs are outside the npm test match). Refs: DX-31557 Co-authored-by: Claude <noreply@anthropic.com>
Refs: DX-31557 Co-authored-by: Claude <noreply@anthropic.com>
…agraph-editable-renderer feat(cms): render tab paragraph through the editable paragraph renderer (DX-31557)
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
The paragraph `content` rich-text helper omitted heading options, so the editor toolbar had no H2-H6. Add h2..h6 to the option set (shape taken from the `rich_text` and `copy` fields of kickstart-stack-seed page.json), update the field instruction to name the real toolbar, regenerate the two paragraph content types, extend the TC-1 spec to assert headings and lists, and document the toolbar (tables are not in it) in CONTENT-MODEL.md section 3.2. Refs: DX-31556 Co-authored-by: Claude <noreply@anthropic.com>
…bar-headings fix(starter-pack): add headings to the paragraph rich-text toolbar (DX-31556)
|
@dange-cstk the heading fix from point 3 is merged into the epic branch via #30 (reviewer-passed, CI green), so this PR now includes it. Generated by Claude Code |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
| '**/slot-maps.spec.ts', | ||
| '**/contentstack-component-type.registry.spec.ts', | ||
| // DX-31556: starter-pack content-type generator output vs shipped JSON. | ||
| '**/starter-pack/content-types.spec.ts', |
There was a problem hiding this comment.
TC-4 to TC-7 (sanitization, tab tagging, empty content) aren't in npm test. Only the starter-pack spec is added to this list. Please wire the TestBed specs into test:all or a CI job before merge. TC-6 covers <script>, <iframe>, onerror and javascript: removal, so without a CI gate a regression there would go unnoticed.
There was a problem hiding this comment.
Not changing it here: leaving the TestBed specs out of npm test is the DSCDX-743 pod decision, and a TestBed jest project or CI job needs new dependencies and a .github/workflows change (security-admin). Suggested as a follow-up ticket; the epic owner decides if it blocks the merge. Details in the PR comment above.
Generated by Claude Code
| expect(field.field_metadata).not.toHaveProperty('multiline'); | ||
| }); | ||
|
|
||
| it('shipped content_types/*.json equal the generator output', () => { |
There was a problem hiding this comment.
This spec compares the generator output with the shipped JSON, which is the only guard against drift. The checks on this PR are CodeQL, Build & verify, security scans and GitGuardian. Can you confirm this spec runs in CI? Without it, drift between the generator and the shipped JSON only surfaces when someone runs tests locally.
There was a problem hiding this comment.
Yes: "Build & verify" runs npm run test:all (ci.yml, "Unit tests"), and jest.config.cjs includes import-export/starter-pack in roots and this spec in testMatch, so generator/JSON drift fails that check.
Generated by Claude Code
| 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', |
There was a problem hiding this comment.
Please confirm whether rich_text_type: "custom" and the options list are required for an HTML RTE text field. If not, the minimal form (allow_rich_text: true) would be simpler. content-types.spec.ts currently asserts rich_text_type === 'custom', so it would need updating too if those keys are removed.
There was a problem hiding this comment.
I can't prove from here that they are optional, and the seed export always carries both, so I kept the exported form; if QA shows allow_rich_text: true alone imports and behaves the same, simplifying is a small generator + TC-1 change.
Generated by Claude Code
| 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): |
There was a problem hiding this comment.
This comment says the field shape was copied from kickstart-stack-seed page.json. Can you link that file, or say which stack you tested against? I couldn't find that source. In the public examples I found, rich_text_type and options appear only on JSON RTE fields, not on text fields with allow_rich_text.
There was a problem hiding this comment.
Source is the rich_text and copy fields in stack/content_types/page.json of https://github.com/contentstack/kickstart-stack-seed (both are data_type: text with allow_rich_text, rich_text_type: custom and options). I did not test against a live stack from this run; QA (DX-31558, TC-8) does the import. Details in the PR comment above. The generator comment now cites it (#30).
Generated by Claude Code
|
|
||
| **`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 |
There was a problem hiding this comment.
The docs list bold, italic, lists and links, but the option list in generate-content-types.mjs also includes underline and deleted, and the TC-6 test shows headings and tables are kept. Can the docs and the field instruction text match the actual options? Authors reading the docs will expect a different toolbar than the one they get.
There was a problem hiding this comment.
Fixed in #30 (merged into this branch): the options now include headings H2-H6, and the field instruction and CONTENT-MODEL §3.2 name the real toolbar (headings, bold, italic, underline, strikethrough, lists, links; tables are kept if present but are not in the toolbar).
Generated by Claude Code
| CMSParagraphComponent: { | ||
| component: ContentstackEditableParagraphComponent, | ||
| }, | ||
| CMSTabParagraphComponent: { |
There was a problem hiding this comment.
DSCDX-743 describes the change as a schema update that keeps the stored value an HTML string, and it doesn't list connector changes. This registration routes CMSTabParagraphComponent to the editable renderer, which is a src/ change beyond the schema update. Should DSCDX-743 be updated to include this, or should the src/ change move to its own ticket? The idea and the diff disagree on scope, so reviewers reading the idea will be surprised by the src/ changes.
There was a problem hiding this comment.
The Epic and TRD (decision A-2, accepted in review) include this registration as DX-31557, since a tab paragraph is not inline-editable in Visual Builder without it; only the idea's wording says "schema". I kept it in this epic; whether to reword DSCDX-743 or split the src/ change is for its owner, and I've flagged it to them.
Generated by Claude Code
Epic DX-31554 (idea DSCDX-743): authors edit SAP paragraphs in Contentstack's HTML rich-text editor in Visual Builder and the entry editor.
Merged into the epic branch
cms_paragraph_componentandcms_tab_paragraph_componentis HTML rich text (generator + regenerated JSON + TC-1 spec + docs).CMSTabParagraphComponentrenders through the editable paragraph renderer (decision A-2); TC-3 mapper spec; TestBed specs TC-4/5/6/7.Gate on the epic branch: lint (0 errors), format:check, typecheck, test:all, build all pass; each PR's CI was green and reviewer-passed; epic-level review passed.
Known gaps
.github/workflowschange: follow-up for@contentstack/security-admin.npm test(pod decision DSCDX-743); run them by hand in a host app.#anchors resolve against<base href>; Angular sanitizer stays on (inline styles removed). Same as plain paragraphs.tab_componentscontainer expand as bare shells (pre-existing); Visual Builder tagging for those would be a separate ticket.QA stories DX-31558, DX-31559 and the security sub-task DX-31555 are for people.
Generated by Claude Code