-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (43 loc) · 1.25 KB
/
index.js
File metadata and controls
48 lines (43 loc) · 1.25 KB
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
/**
* External dependencies
*/
import { connect } from 'react-redux';
/**
* WordPress dependencies
*/
import { __ } from 'i18n';
/**
* Internal dependencies
*/
import './style.scss';
import Inserter from '../../inserter';
import VisualEditorBlock from './block';
import PostTitle from '../../post-title';
import { getBlockUids } from '../../selectors';
function VisualEditor( { blocks, clearSelectedBlock } ) {
// Disable reason: Focus transfer between blocks and key events are handled
// by focused block element. Consider unhandled click bubbling as unselect.
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
return (
<div
role="region"
aria-label={ __( 'Visual Editor' ) }
onClick={ clearSelectedBlock }
className="editor-visual-editor">
<PostTitle />
{ blocks.map( ( uid ) => (
<VisualEditorBlock key={ uid } uid={ uid } />
) ) }
<Inserter position="top right" />
</div>
);
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
}
export default connect(
( state ) => ( {
blocks: getBlockUids( state ),
} ),
( dispatch ) => ( {
clearSelectedBlock: () => dispatch( { type: 'CLEAR_SELECTED_BLOCK' } ),
} )
)( VisualEditor );