How to use the netlify-cms.default function in netlify-cms

To help you get started, we’ve selected a few netlify-cms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github talves / react-static-netlify-cms / src / containers / Admin / index.js View on Github external
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} >}}`,