-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/rich-text-formats
- Loading branch information
Showing
8 changed files
with
80 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** @flow | ||
* @format */ | ||
|
||
import { AppRegistry } from 'react-native'; | ||
import App from './src/app/App'; | ||
AppRegistry.registerComponent( 'gutenberg', () => App ); | ||
import { setupApp } from './src'; | ||
|
||
setupApp(); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// External dependencies | ||
import { AppRegistry } from 'react-native'; | ||
|
||
// Setting up environment | ||
import './globals'; | ||
|
||
const gutenbergSetup = () => { | ||
const apiFetch = require( '@wordpress/api-fetch' ).default; | ||
const wpData = require( '@wordpress/data' ); | ||
|
||
// wp-api-fetch | ||
apiFetch.use( apiFetch.createRootURLMiddleware( 'https://public-api.wordpress.com/' ) ); | ||
|
||
// wp-data | ||
const userId = 1; | ||
const storageKey = 'WP_DATA_USER_' + userId; | ||
wpData.use( wpData.plugins.persistence, { storageKey: storageKey } ); | ||
wpData.use( wpData.plugins.controls ); | ||
}; | ||
|
||
const editorSetup = () => { | ||
const wpBlockLibrary = require( '@wordpress/block-library' ); | ||
const wpBlocks = require( '@wordpress/blocks' ); | ||
const registerCoreBlocks = wpBlockLibrary.registerCoreBlocks; | ||
const registerBlockType = wpBlocks.registerBlockType; | ||
const setUnregisteredTypeHandlerName = wpBlocks.setUnregisteredTypeHandlerName; | ||
const unregisterBlockType = wpBlocks.unregisterBlockType; | ||
const UnsupportedBlock = require( './block-types/unsupported-block' ); | ||
|
||
// register and setup blocks | ||
registerCoreBlocks(); | ||
registerBlockType( UnsupportedBlock.name, UnsupportedBlock.settings ); | ||
setUnregisteredTypeHandlerName( UnsupportedBlock.name ); | ||
|
||
// disable Code and More blocks for release | ||
if ( ! __DEV__ ) { | ||
unregisterBlockType( 'core/code' ); | ||
unregisterBlockType( 'core/more' ); | ||
} | ||
}; | ||
|
||
export function setupApp() { | ||
gutenbergSetup(); | ||
editorSetup(); | ||
|
||
// Making sure the environment is set up before loading any Component | ||
AppRegistry.registerComponent( 'gutenberg', () => require( './app/App' ).default ); | ||
} |