-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
type: bugcode to address defects in shipped codecode to address defects in shipped code
Description
Describe the bug
Using named capture groups in the registerEditorComponent pattern field causes a warning. I think this is because match[0] doesn't exist? Example of my code and the error:
CMS.registerEditorComponent({
id: "image",
label: "Afbeelding",
fields: [{
name: "caption",
label: "Onderschrift",
widget: "string",
},
{
name: "license",
label: "Licentie",
widget: "string",
required: false,
}],
pattern: /^{{< image\n?(?:\scaption="(?<caption>.+)")\n?(?:\slicense="(?<license>.+)")?\s?>}}/,
fromBlock: (match) => {
return {
caption: match.groups.caption,
license: match.groups.license,
};
},
toBlock: (obj) => {
return `{{< image caption="${obj.caption}" >}}`;
},
});Sent invalid data to remark. Plugin: image. Value: {{< image caption="Characters and Caricaturas door William Hogarth.a" >}}. Data: {"caption":"Characters and Caricaturas door William Hogarth.a"}
Applicable Versions:
- Netlify CMS version: 2.15.72
- Git provider: Github
- OS: Alpine Linux
- Browser version: Safari
Metadata
Metadata
Assignees
Labels
type: bugcode to address defects in shipped codecode to address defects in shipped code