Hi I am a creating an Editor Component for HUGO Shortcode.
here is the code but it doesn’t work. please help me fix. I am a newbie…
code
<script>
CMS.registerEditorComponent({
id: "product1"
label: "Product Preview Type 1"
fields: [
{name: 'title', label: 'Title Like Editors Choice', widget: 'string'},
{name: 'amzimg', label: 'Product Image Code', widget: 'string'},
{name: 'amzlink', label: 'AMZ Link', widget: 'string'},
],
fromBlock: function(match) {
return {
title: match[1],
amzimg: match[2],
amzlink: match[3],
};
},
toBlock: function(title, amzimg, amzlink) {
return (
'{{<product1 title="'+ title +'" img="'+ amzimg +'">}}' + amzlink + '{{</product1>}}'
)
}
});
</script>
Please check the code if there are any problem!