-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy patheditor.js
37 lines (32 loc) · 946 Bytes
/
editor.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
/**
* WordPress dependencies
*/
import { withSelect } from '@wordpress/data';
import { EditorProvider, ErrorBoundary } from '@wordpress/editor';
import { StrictMode } from '@wordpress/element';
/**
* Internal dependencies
*/
import Layout from './components/layout';
function Editor( { settings, hasFixedToolbar, post, overridePost, onError, ...props } ) {
if ( ! post ) {
return null;
}
const editorSettings = {
...settings,
hasFixedToolbar,
};
return (
<StrictMode>
<EditorProvider settings={ editorSettings } post={ { ...post, ...overridePost } } { ...props }>
<ErrorBoundary onError={ onError }>
<Layout />
</ErrorBoundary>
</EditorProvider>
</StrictMode>
);
}
export default withSelect( ( select, { postId, postType } ) => ( {
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
post: select( 'core' ).getEntityRecord( 'postType', postType, postId ),
} ) )( Editor );