forked from decaporg/decap-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto/manual init w/ single bundle, BYO root element 🎉 (decaporg#1173)
* ensure that application is only initialized once * allow for single bundle init * enable manual initialization via global flag
- Loading branch information
1 parent
1149560
commit 871b1f6
Showing
6 changed files
with
49 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
/** | ||
* This module provides a self-initializing CMS instance with API hooks added to | ||
* the `window` object. | ||
*/ | ||
import React from 'react'; | ||
import bootstrap from './bootstrap'; | ||
import registry from 'Lib/registry'; | ||
import createReactClass from 'create-react-class'; | ||
|
||
/** | ||
* Load the app. | ||
* Load Netlify CMS automatically if `window.CMS_MANUAL_INIT` is set. | ||
*/ | ||
bootstrap(); | ||
if (!window.CMS_MANUAL_INIT) { | ||
bootstrap(); | ||
} else { | ||
console.log('`window.CMS_MANUAL_INIT` flag set, skipping automatic initialization.'); | ||
} | ||
|
||
/** | ||
* Add extension hooks to global scope. | ||
*/ | ||
const CMS = { ...registry }; | ||
if (typeof window !== 'undefined') { | ||
window.CMS = CMS; | ||
window.CMS = registry; | ||
window.initCMS = bootstrap; | ||
window.createClass = window.createClass || createReactClass; | ||
window.h = window.h || React.createElement; | ||
} | ||
|
||
/** | ||
* Export the registry for projects that import the CMS. | ||
*/ | ||
export default CMS; | ||
export { registry as default, bootstrap as init }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters