2018-11-22 02:18:19 +01:00
|
|
|
import createReactClass from 'create-react-class';
|
|
|
|
import React from 'react';
|
2019-03-16 15:44:29 -07:00
|
|
|
import * as CMS from 'netlify-cms-core/src';
|
2018-07-23 23:40:48 -04:00
|
|
|
import './backends';
|
|
|
|
import './widgets';
|
|
|
|
import './editor-components';
|
2018-08-30 16:24:28 -04:00
|
|
|
import './media-libraries';
|
2018-07-27 12:25:35 -04:00
|
|
|
|
2018-11-22 02:18:19 +01:00
|
|
|
/**
|
|
|
|
* Load Netlify CMS automatically if `window.CMS_MANUAL_INIT` is set.
|
|
|
|
*/
|
|
|
|
if (!window.CMS_MANUAL_INIT) {
|
2019-03-16 15:44:29 -07:00
|
|
|
CMS.init();
|
2018-11-22 02:18:19 +01:00
|
|
|
} else {
|
|
|
|
console.log('`window.CMS_MANUAL_INIT` flag set, skipping automatic initialization.');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add extension hooks to global scope.
|
|
|
|
*/
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
window.CMS = CMS;
|
2019-03-16 15:44:29 -07:00
|
|
|
window.initCMS = CMS.init;
|
2018-11-22 02:18:19 +01:00
|
|
|
window.createClass = window.createClass || createReactClass;
|
|
|
|
window.h = window.h || React.createElement;
|
|
|
|
}
|
|
|
|
|
2019-03-16 15:44:29 -07:00
|
|
|
export const NetlifyCms = CMS;
|
|
|
|
export { CMS as default };
|