/
index.native.js
40 lines (36 loc) · 1.1 KB
/
index.native.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* WordPress dependencies
*/
import '@wordpress/core-data';
import '@wordpress/format-library';
import { dispatch } from '@wordpress/data';
import { store as preferencesStore } from '@wordpress/preferences';
/**
* Internal dependencies
*/
export { store } from './store';
import Editor from './editor';
/**
* Initializes the Editor and returns a componentProvider
* that can be registered with `AppRegistry.registerComponent`
*
* @param {string} id Unique identifier for editor instance.
* @param {Object} postType Post type of the post to edit.
* @param {Object} postId ID of the post to edit (unused right now)
*/
export function initializeEditor( id, postType, postId ) {
dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
editorMode: 'visual',
fullscreenMode: true,
hiddenBlockTypes: [],
inactivePanels: [],
isPublishSidebarEnabled: true,
openPanels: [ 'post-status' ],
preferredStyleVariations: {},
welcomeGuide: true,
} );
dispatch( preferencesStore ).setDefaults( 'core', {
fixedToolbar: false,
} );
return <Editor postId={ postId } postType={ postType } />;
}