Skip to content

Commit

Permalink
Custom widgets - fix example for registerEditorComponent (decaporg#80)
Browse files Browse the repository at this point in the history
* /decaporg/decap-cms/issues/7102 documentation for publish mode possible values

* fix: /decaporg/decap-cms/issues/6797 registerEditorComponent example
  • Loading branch information
hip3r authored Oct 7, 2024
1 parent ac3ca15 commit c4b3220
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions content/docs/custom-widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ CMS.registerEditorComponent({
//
// 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,
pattern: /^<details><summary>(.*?)<\/summary>(.*?)<\/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`.
Expand All @@ -163,14 +163,7 @@ CMS.registerEditorComponent({
// 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.contents}

</details>
`;
return `<details><summary>${data.summary}</summary>${data.contents}</details>`;
},
// Preview output for this component. Can either be a string or a React component
// (component gives better render performance)
Expand Down

0 comments on commit c4b3220

Please sign in to comment.