Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props)
const CMSExport = require('netlify-cms')
const CMS = CMSExport.default
CMS.init = CMSExport.init
console.log('CMS stored in state of component Admin', CMS)
this.state = {
CMS,
}
CMS.registerPreviewStyle('/admin/site.css')
CMS.registerPreviewTemplate('docs', DocumentPreview)
CMS.registerEditorComponent({
id: 'youtube',
label: 'Youtube',
fields: [{ name: 'id', label: 'Youtube Video ID' }],
pattern: /^{{<\s?youtube (\S+)\s?>}}/,
fromBlock: match => ({
id: match[1],
}),
toBlock: obj => `{{< youtube ${obj.id} >}}`,