-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathindex.js
52 lines (44 loc) · 1.26 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
/**
* WordPress dependencies
*/
import { addAction, addFilter } from '@wordpress/hooks';
import {
doGutenbergNativeSetup,
initialHtmlGutenberg,
} from '@wordpress/react-native-editor';
/**
* Internal dependencies
*/
import correctTextFontWeight from './text-font-weight-correct';
import setupJetpackEditor from './jetpack-editor-setup';
import setupBlockExperiments from './block-experiments-setup';
import initialHtml from './initial-html';
addAction( 'native.pre-render', 'gutenberg-mobile', () => {
require( './strings-overrides' );
correctTextFontWeight();
} );
addAction( 'native.render', 'gutenberg-mobile', ( props ) => {
setupJetpackEditor(
props.jetpackState || { blogId: 1, isJetpackActive: true }
);
const capabilities = props.capabilities ?? {};
setupBlockExperiments( capabilities );
} );
addFilter( 'native.block_editor_props', 'gutenberg-mobile', ( editorProps ) => {
if ( __DEV__ ) {
let { initialTitle, initialData } = editorProps;
if ( initialTitle === undefined ) {
initialTitle = 'Welcome to gutenberg for WP Apps!';
}
if ( initialData === undefined ) {
initialData = initialHtml + initialHtmlGutenberg;
}
return {
...editorProps,
initialTitle,
initialData,
};
}
return editorProps;
} );
doGutenbergNativeSetup();