Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { FileSystemBackend } from "netlify-cms-backend-fs"
import CMS, { init } from "netlify-cms"
const isClient = typeof window !== "undefined"
const isDevelopment = process.env.NODE_ENV === "development"
if (isClient) {
window.CMS_MANUAL_INIT = true
}
if (isDevelopment) {
// Allows for local development overrides in cms.yaml
window.CMS_ENV = "localhost_development"
// Attach to the file system
CMS.registerBackend("file-system", FileSystemBackend)
}
// @ts-check
// Custom components need refs for validation and thus must be a class.
// Additionally, after , only one child is allowed.
// See https://github.com/netlify/netlify-cms/issues/1346
class MDXWidget extends Component {
render() {
return (
)
}
componentDidMount () {
console.log(`CMS [${process.env.NODE_ENV}]`, CMS, )
if (process.env.NODE_ENV === 'development') {
config.backend = {
"name": "file-system",
"api_root": "http://localhost:3000/api"
}
CMS.registerBackend('file-system', FileSystemBackend);
}
CMS.init({config});
CMS.registerPreviewTemplate('authors', AuthorsPreview);
CMS.registerEditorComponent(EditorYoutube);
}
render() {