improvement: move window/umd bridge out of core (#1865)

This commit is contained in:
Loïc Mahieu 2018-11-22 02:18:19 +01:00 committed by Shawn Erquhart
parent 855efd848e
commit 8f0d2d64a8
4 changed files with 22 additions and 22 deletions

View File

@ -21,7 +21,6 @@
"dependencies": {
"ajv": "^6.4.0",
"ajv-errors": "^1.0.0",
"create-react-class": "^15.6.0",
"diacritics": "^1.3.0",
"emotion": "^9.2.6",
"fuzzy": "^0.1.1",

View File

@ -1,25 +1,4 @@
import React from 'react';
import bootstrap from './bootstrap';
import registry from 'Lib/registry';
import createReactClass from 'create-react-class';
/**
* Load Netlify CMS automatically if `window.CMS_MANUAL_INIT` is set.
*/
if (!window.CMS_MANUAL_INIT) {
bootstrap();
} else {
console.log('`window.CMS_MANUAL_INIT` flag set, skipping automatic initialization.');
}
/**
* Add extension hooks to global scope.
*/
if (typeof window !== 'undefined') {
window.CMS = registry;
window.initCMS = bootstrap;
window.createClass = window.createClass || createReactClass;
window.h = window.h || React.createElement;
}
export { registry as default, bootstrap as init };

View File

@ -21,6 +21,7 @@
],
"license": "MIT",
"dependencies": {
"create-react-class": "^15.6.0",
"emotion": "^9.2.6",
"netlify-cms-backend-bitbucket": "^2.1.0",
"netlify-cms-backend-git-gateway": "^2.1.0",

View File

@ -1,7 +1,28 @@
import createReactClass from 'create-react-class';
import React from 'react';
import CMS, { init } from 'netlify-cms-core/src';
import './backends';
import './widgets';
import './editor-components';
import './media-libraries';
/**
* Load Netlify CMS automatically if `window.CMS_MANUAL_INIT` is set.
*/
if (!window.CMS_MANUAL_INIT) {
init();
} 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;
window.initCMS = init;
window.createClass = window.createClass || createReactClass;
window.h = window.h || React.createElement;
}
export { CMS as default, init };