2018-11-22 02:18:19 +01:00
|
|
|
import createReactClass from 'create-react-class';
|
|
|
|
import React from 'react';
|
2019-03-28 11:37:23 -07:00
|
|
|
import { NetlifyCmsApp as CMS } from 'netlify-cms-app/dist/esm';
|
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-22 08:24:46 -07:00
|
|
|
/**
|
|
|
|
* Log the version number.
|
|
|
|
*/
|
|
|
|
if (typeof NETLIFY_CMS_VERSION === 'string') {
|
|
|
|
console.log(`netlify-cms ${NETLIFY_CMS_VERSION}`);
|
|
|
|
}
|
2018-11-22 02:18:19 +01:00
|
|
|
}
|
|
|
|
|
2019-03-25 16:23:24 -07:00
|
|
|
export const NetlifyCms = {
|
|
|
|
...CMS,
|
|
|
|
};
|
|
|
|
export default CMS;
|