Collapsible Note custom editor component from the documentation not working
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript, markdown
- Domain
- documentation
Research direction
Start with the Collapsible Note custom editor example in the documentation and compare the field name declared in fields with the properties returned by fromBlock and used by toBlock and toPreview. Correct the inconsistent name so the details text appears in the preview, then verify the example in the markdown editor using the reproduction steps.
Written by the indexing model from the issue text.
Description
Describe the bug
I am trying to use Custom Editor Components and I cant get the markdown widget to behave properly
Just using the Collapsible Note example from the documentation results in an "undefined" displayed in the "details" part of the component.
To Reproduce
- Add the Collapsible Note example to your
cms.js:
CMS.registerEditorComponent({
// Internal id of the component
id: "collapsible-note",
// Visible label
label: "Collapsible Note",
// Fields the user need to fill out when adding an instance of the component
fields: [
{
name: 'summary',
label: 'Summary',
widget: 'string'
},
{
name: 'details',
label: 'Details',
widget: 'markdown'
}
],
// Regex pattern used to search for instances of this block in the markdown document.
// Patterns are run in a multline environment (against the entire markdown document),
// and so generally should make use of the multiline flag (`m`). If you need to capture
// newlines in your capturing groups, you can either use something like
// `([\S\s]*)`, or you can additionally enable the "dot all" flag (`s`),
// which will cause `(.*)` to match newlines as well.
//
// Additionally, it's recommended that you use non-greedy capturing groups (e.g.
// `(.*?)` vs `(.*)`), especially if matching against newline characters.
pattern: /^<details>$\s*?<summary>(.*?)<\/summary>\n\n(.*?)\n^<\/details>$/ms,
// Given a RegExp Match object
// (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#return_value),
// return an object with one property for each field defined in `fields`.
//
// This is used to populate the custom widget in the markdown editor in the CMS.
fromBlock: function(match) {
return {
summary: match[1],
detail: match[2]
};
},
// Given an object with one property for each field defined in `fields`,
// return the string you wish to be inserted into your markdown.
//
// This is used to serialize the data from the custom widget to the
// markdown document
toBlock: function(data) {
return `
<details>
<summary>${data.summary}</summary>
${data.detail}
</details>
`;
},
// Preview output for this component. Can either be a string or a React component
// (component gives better render performance)
toPreview: function(data) {
return `
<details>
<summary>${data.summary}</summary>
${data.detail}
</details>
`;
}
});
- Going to your markdown editor and adding a Collapsible Note component
- Putting text in it
- Observing the "undefined" text on the preview
Expected behavior
Having a preview that displays the text in the "details" area
Screenshots

Applicable Versions:
- netlify-cms-app 2.15.61
- netlify-cms-core 2.54.2
- OS: Fedora 35
- Browser version: Firefox 95.0
- Node.JS version: v12
- Dominant language
- SCSS
- Stars
- 13
- Forks
- 322
- Avg merge
- 14m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from decaporg/decap-website
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
decaporg/decap-website#130 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
decaporg/decap-website#128 · 3 reactions ·
-
Difficulty 1/5 Under an hour Newbie friendliness 50/100
decaporg/decap-website#108 ·
-
RSS on decapcms Blog Openfeature
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
decaporg/decap-website#91 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
decaporg/decap-website#79 · 12 comments ·
All issues in decaporg/decap-website
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) Opencategory/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
Difficulty 1/5 Under an hour Newbie friendliness 84/100